def test_hide_filtered_elements__category_include(self): root = Root() category1 = Category("c") category2 = Category("c") category3 = Category("c") category1.name = "v1" category2.name = "v2" category3.name = "v3" root.categories = {"s1": category1, "s2": category2, "s3": category3} config = ConfigObject() config["filter"]["categories"]["includes"] = ["v1", "v3"] self.source.hide_filtered_elements(root, config["filter"]) self.assertTrue(category1.display) self.assertFalse(category2.display) self.assertTrue(category3.display)
def test_category(self): category = Category("a") category.name = "a" category.description = "b" category.order = 2 category_dto = CategoryDto(category) self.assertEqual("a", category_dto.name) self.assertEqual("b", category_dto.description) self.assertEqual(2, category_dto.order)
def test_hide_filtered_elements__category(self): root = Root() version1 = Version() category1 = Category("c") category2 = Category("c") category3 = Category("c") category1.name = "v1" category2.name = "v2" category3.name = "v3" root.versions = {"v1": version1} version1.categories = {"s1": category1, "s2": category2, "s3": category3} config = ConfigObject() self.source.hide_filtered_elements(root, config["filter"]) self.assertTrue(category1.display) self.assertTrue(category2.display) self.assertTrue(category3.display)