Explicitely set transform=repr in assertQuerysetEquals
This commit is contained in:
parent
0e1ff1765a
commit
a20a1c11d6
4 changed files with 51 additions and 15 deletions
|
@ -194,7 +194,9 @@ class RegistrationViewTests(ViewTestCaseMixin, TestCase):
|
|||
)
|
||||
|
||||
er = e.eventregistration_set.get(user=self.users["user"])
|
||||
self.assertQuerysetEqual(er.options.all(), map(repr, [oc1, oc3]), ordered=False)
|
||||
self.assertQuerysetEqual(
|
||||
er.options.all(), map(repr, [oc1, oc3]), transform=repr, ordered=False
|
||||
)
|
||||
self.assertCountEqual(
|
||||
er.comments.values_list("content", flat=True), ["comment 1"]
|
||||
)
|
||||
|
@ -299,10 +301,10 @@ class RegistrationAutocompleteViewTests(MockLDAPMixin, ViewTestCaseMixin, TestCa
|
|||
raise ValueError("Unexpected section name: {}".format(section.name))
|
||||
|
||||
self.assertQuerysetEqual(
|
||||
others, map(str, expected_others), ordered=False, transform=str
|
||||
others, map(str, expected_others), transform=str, ordered=False
|
||||
)
|
||||
self.assertQuerysetEqual(
|
||||
members, map(str, expected_members), ordered=False, transform=str
|
||||
members, map(str, expected_members), transform=str, ordered=False
|
||||
)
|
||||
self.assertSetEqual(
|
||||
set(clippers), set(map(LDAPSearch().result_verbose_name, expected_clippers))
|
||||
|
@ -648,7 +650,10 @@ class ClubListViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertQuerysetEqual(
|
||||
r.context["owned_clubs"], map(repr, [self.c1, self.c2]), ordered=False
|
||||
r.context["owned_clubs"],
|
||||
map(repr, [self.c1, self.c2]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
|
||||
|
@ -950,7 +955,10 @@ class EventViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
er = self.e.eventregistration_set.get(user=self.users["user"])
|
||||
self.assertQuerysetEqual(
|
||||
er.options.all(), map(repr, [self.oc1, self.oc3, self.oc4]), ordered=False
|
||||
er.options.all(),
|
||||
map(repr, [self.oc1, self.oc3, self.oc4]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
# TODO: Make the view care about comments.
|
||||
# self.assertQuerysetEqual(
|
||||
|
@ -975,7 +983,9 @@ class EventViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertIn(self.post_expected_message, get_messages(r.wsgi_request))
|
||||
|
||||
er.refresh_from_db()
|
||||
self.assertQuerysetEqual(er.options.all(), map(repr, [self.oc3]), ordered=False)
|
||||
self.assertQuerysetEqual(
|
||||
er.options.all(), map(repr, [self.oc3]), transform=repr, ordered=False
|
||||
)
|
||||
# TODO: Make the view care about comments.
|
||||
# self.assertQuerysetEqual(
|
||||
# er.comments.all(), map(repr, []),
|
||||
|
@ -1029,7 +1039,10 @@ class EventStatusViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertQuerysetEqual(
|
||||
r.context["user_choices"], map(repr, expected), ordered=False
|
||||
r.context["user_choices"],
|
||||
map(repr, expected),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
def test_filter_none(self):
|
||||
|
@ -1096,7 +1109,10 @@ class SurveyViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
a = self.s.surveyanswer_set.get(user=self.users["user"])
|
||||
self.assertQuerysetEqual(
|
||||
a.answers.all(), map(repr, [self.qa1, self.qa3, self.qa4]), ordered=False
|
||||
a.answers.all(),
|
||||
map(repr, [self.qa1, self.qa3, self.qa4]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
def test_post_edit(self):
|
||||
|
@ -1115,7 +1131,9 @@ class SurveyViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertIn(self.post_expected_message, get_messages(r.wsgi_request))
|
||||
|
||||
a.refresh_from_db()
|
||||
self.assertQuerysetEqual(a.answers.all(), map(repr, [self.qa3]), ordered=False)
|
||||
self.assertQuerysetEqual(
|
||||
a.answers.all(), map(repr, [self.qa3]), transform=repr, ordered=False
|
||||
)
|
||||
|
||||
def test_post_delete(self):
|
||||
a = self.s.surveyanswer_set.create(user=self.users["user"])
|
||||
|
@ -1196,7 +1214,10 @@ class SurveyStatusViewTests(ViewTestCaseMixin, TestCase):
|
|||
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertQuerysetEqual(
|
||||
r.context["user_answers"], map(repr, expected), ordered=False
|
||||
r.context["user_answers"],
|
||||
map(repr, expected),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
def test_filter_none(self):
|
||||
|
|
|
@ -40,6 +40,7 @@ class UserGroupFormTests(TestCase):
|
|||
self.assertQuerysetEqual(
|
||||
groups_field.queryset,
|
||||
[repr(g.group_ptr) for g in self.kfet_groups],
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
|
|
|
@ -94,6 +94,7 @@ class PermHelpersTest(TestCaseMixin, TestCase):
|
|||
self.assertQuerysetEqual(
|
||||
user.user_permissions.all(),
|
||||
map(repr, [self.perm1, self.perm2, self.perm_team]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
|
|
|
@ -520,6 +520,7 @@ class AccountGroupCreateViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertQuerysetEqual(
|
||||
group.permissions.all(),
|
||||
map(repr, [self.perms["kfet.is_team"], self.perms["kfet.manage_perms"]]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
|
@ -573,6 +574,7 @@ class AccountGroupUpdateViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertQuerysetEqual(
|
||||
self.group.permissions.all(),
|
||||
map(repr, [self.perms["kfet.is_team"], self.perms["kfet.manage_perms"]]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
|
@ -600,6 +602,7 @@ class AccountNegativeListViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertQuerysetEqual(
|
||||
r.context["negatives"],
|
||||
map(repr, [self.accounts["user"].negative]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
|
@ -877,6 +880,7 @@ class CheckoutListViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertQuerysetEqual(
|
||||
r.context["checkouts"],
|
||||
map(repr, [self.checkout1, self.checkout2]),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
|
@ -1067,6 +1071,7 @@ class CheckoutStatementListViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertQuerysetEqual(
|
||||
r.context["checkoutstatements"],
|
||||
map(repr, expected_statements),
|
||||
transform=repr,
|
||||
ordered=False,
|
||||
)
|
||||
|
||||
|
@ -1293,7 +1298,9 @@ class ArticleCategoryListViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
self.assertQuerysetEqual(
|
||||
r.context["categories"], map(repr, [self.category1, self.category2])
|
||||
r.context["categories"],
|
||||
map(repr, [self.category1, self.category2]),
|
||||
transform=repr,
|
||||
)
|
||||
|
||||
|
||||
|
@ -1368,7 +1375,9 @@ class ArticleListViewTests(ViewTestCaseMixin, TestCase):
|
|||
r = self.client.get(self.url)
|
||||
self.assertEqual(r.status_code, 200)
|
||||
self.assertQuerysetEqual(
|
||||
r.context["articles"], map(repr, [self.article1, self.article2])
|
||||
r.context["articles"],
|
||||
map(repr, [self.article1, self.article2]),
|
||||
transform=repr,
|
||||
)
|
||||
|
||||
|
||||
|
@ -4435,7 +4444,9 @@ class InventoryListViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
inventories = r.context["inventories"]
|
||||
self.assertQuerysetEqual(inventories, map(repr, [self.inventory]))
|
||||
self.assertQuerysetEqual(
|
||||
inventories, map(repr, [self.inventory]), transform=repr
|
||||
)
|
||||
|
||||
|
||||
class InventoryCreateViewTests(ViewTestCaseMixin, TestCase):
|
||||
|
@ -4622,7 +4633,7 @@ class OrderListViewTests(ViewTestCaseMixin, TestCase):
|
|||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
orders = r.context["orders"]
|
||||
self.assertQuerysetEqual(orders, map(repr, [self.order]))
|
||||
self.assertQuerysetEqual(orders, map(repr, [self.order]), transform=repr)
|
||||
|
||||
|
||||
class OrderReadViewTests(ViewTestCaseMixin, TestCase):
|
||||
|
@ -4837,7 +4848,9 @@ class OrderToInventoryViewTests(ViewTestCaseMixin, TestCase):
|
|||
inventory,
|
||||
{"by": self.accounts["team1"], "at": self.now, "order": self.order},
|
||||
)
|
||||
self.assertQuerysetEqual(inventory.articles.all(), map(repr, [self.article]))
|
||||
self.assertQuerysetEqual(
|
||||
inventory.articles.all(), map(repr, [self.article]), transform=repr
|
||||
)
|
||||
|
||||
compte = InventoryArticle.objects.get(article=self.article)
|
||||
|
||||
|
|
Loading…
Reference in a new issue