Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use bulk_create to test ordered collections #3143

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions bookwyrm/tests/models/test_activitypub_mixin.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,13 @@ def test_to_undo_activity(self, *_):
def test_to_ordered_collection_page(self, *_):
"""make sure the paged results of an ordered collection work"""
self.assertEqual(PAGE_LENGTH, 15)
for number in range(0, 2 * PAGE_LENGTH):
models.Status.objects.create(
models.Status.objects.bulk_create(
models.Status(
user=self.local_user,
content=f"test status {number}",
)
for number in range(2 * PAGE_LENGTH)
)
page_1 = to_ordered_collection_page(
models.Status.objects.all(), "http://fish.com/", page=1
)
Expand All @@ -416,13 +418,13 @@ def test_to_ordered_collection_page(self, *_):
def test_to_ordered_collection(self, *_):
"""convert a queryset into an ordered collection object"""
self.assertEqual(PAGE_LENGTH, 15)

for number in range(0, 2 * PAGE_LENGTH):
models.Status.objects.create(
models.Status.objects.bulk_create(
models.Status(
user=self.local_user,
content=f"test status {number}",
)

for number in range(2 * PAGE_LENGTH)
)
MockSelf = namedtuple("Self", ("remote_id"))
mock_self = MockSelf("")

Expand Down
Loading