Beispiel #1
0
    def test_category_compare__with_order(self):
        category1 = CategoryDto(Category("c"))
        category2 = CategoryDto(Category("c"))
        category1.order = 1
        category2.order = 2

        self.assertEqual(category1, sorted([category2, category1])[0])
Beispiel #2
0
    def test_category_compare__with_name(self):
        category1 = CategoryDto(Category("a"))
        category2 = CategoryDto(Category("b"))
        category1.order = 1
        category1.label = "a"
        category2.order = 1
        category2.label = "a"

        self.assertEqual(category1, sorted([category2, category1])[0])
Beispiel #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)
Beispiel #4
0
 def test_sort_category_lt__on_order(self):
     v1 = CategoryDto(Category("a"))
     v1.order = 1
     v2 = CategoryDto(Category("a"))
     v2.order = 2
     self.assertLess(v1, v2)
Beispiel #5
0
 def test_sort_category_lt(self):
     v1 = CategoryDto(Category("a"))
     v2 = CategoryDto(Category("b"))
     self.assertLess(v1, v2)
Beispiel #6
0
 def test_sort_category_equals(self):
     v1 = CategoryDto(Category("a"))
     v1.order = 1
     v2 = CategoryDto(Category("a"))
     v2.order = 1
     self.assertEqual(v1, v2)