mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-11-26 11:31:08 +00:00
Use bulk_create to test ordered collections
This commit is contained in:
parent
cf1afefc84
commit
5384e4c470
1 changed files with 8 additions and 6 deletions
|
@ -391,11 +391,13 @@ class ActivitypubMixins(TestCase):
|
||||||
def test_to_ordered_collection_page(self, *_):
|
def test_to_ordered_collection_page(self, *_):
|
||||||
"""make sure the paged results of an ordered collection work"""
|
"""make sure the paged results of an ordered collection work"""
|
||||||
self.assertEqual(PAGE_LENGTH, 15)
|
self.assertEqual(PAGE_LENGTH, 15)
|
||||||
for number in range(0, 2 * PAGE_LENGTH):
|
models.Status.objects.bulk_create(
|
||||||
models.Status.objects.create(
|
models.Status(
|
||||||
user=self.local_user,
|
user=self.local_user,
|
||||||
content=f"test status {number}",
|
content=f"test status {number}",
|
||||||
)
|
)
|
||||||
|
for number in range(2 * PAGE_LENGTH)
|
||||||
|
)
|
||||||
page_1 = to_ordered_collection_page(
|
page_1 = to_ordered_collection_page(
|
||||||
models.Status.objects.all(), "http://fish.com/", page=1
|
models.Status.objects.all(), "http://fish.com/", page=1
|
||||||
)
|
)
|
||||||
|
@ -416,13 +418,13 @@ class ActivitypubMixins(TestCase):
|
||||||
def test_to_ordered_collection(self, *_):
|
def test_to_ordered_collection(self, *_):
|
||||||
"""convert a queryset into an ordered collection object"""
|
"""convert a queryset into an ordered collection object"""
|
||||||
self.assertEqual(PAGE_LENGTH, 15)
|
self.assertEqual(PAGE_LENGTH, 15)
|
||||||
|
models.Status.objects.bulk_create(
|
||||||
for number in range(0, 2 * PAGE_LENGTH):
|
models.Status(
|
||||||
models.Status.objects.create(
|
|
||||||
user=self.local_user,
|
user=self.local_user,
|
||||||
content=f"test status {number}",
|
content=f"test status {number}",
|
||||||
)
|
)
|
||||||
|
for number in range(2 * PAGE_LENGTH)
|
||||||
|
)
|
||||||
MockSelf = namedtuple("Self", ("remote_id"))
|
MockSelf = namedtuple("Self", ("remote_id"))
|
||||||
mock_self = MockSelf("")
|
mock_self = MockSelf("")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue