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
|
2023-07-10 14:05:38 -04:00
|
|
|
from hub.catalog_factories.costs_catalog_factory import CostsCatalogFactory
|
2023-02-01 10:38:38 -05:00
|
|
|
|
|
|
|
|
|
|
|
class TestCostsCatalog(TestCase):
|
|
|
|
|
|
|
|
def test_costs_catalog(self):
|
2023-07-10 14:05:38 -04:00
|
|
|
catalog = CostsCatalogFactory('montreal_custom').catalog
|
2023-02-01 10:38:38 -05:00
|
|
|
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')
|