Skip to content

Commit 4c527e7

Browse files
committed
Automatically adjust test to page_size.
1 parent afec45b commit 4c527e7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

pydis_site/apps/api/tests/test_users.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from .base import AuthenticatedAPITestCase
77
from ..models import Role, User
88
from ..models.bot.metricity import NotFoundError
9+
from ..viewsets.bot.user import UserListPagination
910

1011

1112
class UnauthedUserAPITests(AuthenticatedAPITestCase):
@@ -357,7 +358,7 @@ class UserPaginatorTests(AuthenticatedAPITestCase):
357358
@classmethod
358359
def setUpTestData(cls):
359360
users = []
360-
for i in range(1, 10_001):
361+
for i in range(1, UserListPagination.page_size + 1):
361362
users.append(User(
362363
id=i,
363364
name=f"user{i}",
@@ -373,9 +374,10 @@ def test_returns_single_page_response(self):
373374
self.assertIsNone(response["previous_page_no"])
374375

375376
def test_returns_next_page_number(self):
377+
user_id = UserListPagination.page_size + 1
376378
User.objects.create(
377-
id=10_001,
378-
name="user10001",
379+
id=user_id,
380+
name=f"user{user_id}",
379381
discriminator=1111,
380382
in_guild=True
381383
)
@@ -384,9 +386,10 @@ def test_returns_next_page_number(self):
384386
self.assertEqual(2, response["next_page_no"])
385387

386388
def test_returns_previous_page_number(self):
389+
user_id = UserListPagination.page_size + 1
387390
User.objects.create(
388-
id=10_001,
389-
name="user10001",
391+
id=user_id,
392+
name=f"user{user_id}",
390393
discriminator=1111,
391394
in_guild=True
392395
)

0 commit comments

Comments
 (0)