city_retrofit/tests/test_costs_catalog.py

29 lines
936 B
Python
Raw Normal View History

2023-02-01 10:38:38 -05:00
"""
TestMontrealCustomCatalog
SPDX - License - Identifier: LGPL - 3.0 - or -later
Copyright © 2022 Concordia CERC group
Project Coder Atiya atiya.atiya@mail.concordia.ca
Code contributors: Pilar Monsalvete Alvarez de Uribarri pilar.monsalvete@concordia.ca
"""
from unittest import TestCase
from hub.catalog_factories.costs_catalog_factory import CostCatalogFactory
class TestCostsCatalog(TestCase):
def test_costs_catalog(self):
catalog = CostCatalogFactory('montreal_custom').catalog
catalog_categories = catalog.names()
self.assertIsNotNone(catalog, 'catalog is none')
content = catalog.entries()
2023-03-22 16:17:08 -04:00
self.assertTrue(len(content.archetypes) == 2)
2023-02-01 10:38:38 -05:00
# retrieving all the entries should not raise any exceptions
for category in catalog_categories:
for value in catalog_categories[category]:
catalog.get_entry(value)
with self.assertRaises(IndexError):
catalog.get_entry('unknown')