Skip to content

Commit

Permalink
Fix issue avoid-misusing-assert-true found at https://codereview.doctor
Browse files Browse the repository at this point in the history
 (#306)
  • Loading branch information
code-review-doctor committed Feb 16, 2022
1 parent 25dbaed commit 8b48d18
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions spirit/category/admin/tests.py
Expand Up @@ -201,20 +201,20 @@ def test_category_order(self):
Category.objects.all().delete()
cat1 = utils.create_category(title="1", sort=2)
cat2 = utils.create_category(title="2", sort=1)
self.assertTrue(list(Category.objects.all()), [cat1, cat2])
self.assertEqual(list(Category.objects.all()), [cat1, cat2])
form = CategoryForm(data=None)
self.assertTrue(list(form.fields['parent'].queryset), [cat2, cat1])
self.assertEqual(list(form.fields['parent'].queryset), [cat2, cat1])
cat1.sort = 0
cat1.save()
self.assertTrue(list(Category.objects.all()), [cat1, cat2])
self.assertEqual(list(Category.objects.all()), [cat1, cat2])
form = CategoryForm(data=None)
self.assertTrue(list(form.fields['parent'].queryset), [cat1, cat2])
self.assertEqual(list(form.fields['parent'].queryset), [cat1, cat2])

@override_settings(ST_ORDERED_CATEGORIES=False)
def test_category_order_by_title(self):
Category.objects.all().delete()
cat1 = utils.create_category(title="1", sort=2)
cat2 = utils.create_category(title="2", sort=1)
self.assertTrue(list(Category.objects.all()), [cat1, cat2])
self.assertEqual(list(Category.objects.all()), [cat1, cat2])
form = CategoryForm(data=None)
self.assertTrue(list(form.fields['parent'].queryset), [cat1, cat2])
self.assertEqual(list(form.fields['parent'].queryset), [cat1, cat2])

0 comments on commit 8b48d18

Please sign in to comment.