Fixes nondeterministic order of query causing test failure

This commit is contained in:
Mouse Reeve 2020-11-27 12:25:01 -08:00
parent 257a29dcfd
commit 44a0ef3b0b

View file

@ -27,7 +27,9 @@ class User(TestCase):
shelves = models.Shelf.objects.filter(user=self.user).all() shelves = models.Shelf.objects.filter(user=self.user).all()
self.assertEqual(len(shelves), 3) self.assertEqual(len(shelves), 3)
names = [s.name for s in shelves] names = [s.name for s in shelves]
self.assertEqual(names, ['To Read', 'Currently Reading', 'Read']) self.assertTrue('To Read' in names)
self.assertTrue('Currently Reading' in names)
self.assertTrue('Read' in names)
ids = [s.identifier for s in shelves] ids = [s.identifier for s in shelves]
self.assertEqual(ids, ['to-read', 'reading', 'read']) self.assertEqual(ids, ['to-read', 'reading', 'read'])