示例#1
0
    def create_from_name_and_dictionary(self, name, datas):
        """Return a populated object Category from dictionary datas
        """
        category = ObjectCategory(name)
        self.set_common_datas(category, name, datas)

        if "order" in datas:
            category.order = int(datas["order"])

        return category
示例#2
0
    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)
示例#3
0
    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)