hub/tests/test_costs_catalog.py
Saeed Ranjbar 3cbc13d302 New Cost Catalogue
The xml file and catalogue importer are changed and tested
2024-03-27 19:56:35 -04:00

48 lines
1.5 KiB
Python

"""
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 CostsCatalogFactory
class TestCostsCatalog(TestCase):
def test_costs_catalog(self):
catalog = CostsCatalogFactory('montreal_custom').catalog
catalog_categories = catalog.names()
self.assertIsNotNone(catalog, 'catalog is none')
content = catalog.entries()
self.assertTrue(len(content.archetypes) == 2)
# 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')
print(catalog.entries())
def test_new_costs_catalog(self):
catalog = CostsCatalogFactory('montreal_complete').catalog_debug
catalog_categories = catalog.names()
self.assertIsNotNone(catalog, 'catalog is none')
content = catalog.entries()
self.assertTrue(len(content.archetypes) == 2)
# 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')
print(catalog.entries())