File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 6
6
from .base import AuthenticatedAPITestCase
7
7
from ..models import Role , User
8
8
from ..models .bot .metricity import NotFoundError
9
+ from ..viewsets .bot .user import UserListPagination
9
10
10
11
11
12
class UnauthedUserAPITests (AuthenticatedAPITestCase ):
@@ -357,7 +358,7 @@ class UserPaginatorTests(AuthenticatedAPITestCase):
357
358
@classmethod
358
359
def setUpTestData (cls ):
359
360
users = []
360
- for i in range (1 , 10_001 ):
361
+ for i in range (1 , UserListPagination . page_size + 1 ):
361
362
users .append (User (
362
363
id = i ,
363
364
name = f"user{ i } " ,
@@ -373,9 +374,10 @@ def test_returns_single_page_response(self):
373
374
self .assertIsNone (response ["previous_page_no" ])
374
375
375
376
def test_returns_next_page_number (self ):
377
+ user_id = UserListPagination .page_size + 1
376
378
User .objects .create (
377
- id = 10_001 ,
378
- name = "user10001 " ,
379
+ id = user_id ,
380
+ name = f"user { user_id } " ,
379
381
discriminator = 1111 ,
380
382
in_guild = True
381
383
)
@@ -384,9 +386,10 @@ def test_returns_next_page_number(self):
384
386
self .assertEqual (2 , response ["next_page_no" ])
385
387
386
388
def test_returns_previous_page_number (self ):
389
+ user_id = UserListPagination .page_size + 1
387
390
User .objects .create (
388
- id = 10_001 ,
389
- name = "user10001 " ,
391
+ id = user_id ,
392
+ name = f"user { user_id } " ,
390
393
discriminator = 1111 ,
391
394
in_guild = True
392
395
)
Original file line number Diff line number Diff line change 19
19
class UserListPagination (PageNumberPagination ):
20
20
"""Custom pagination class for the User Model."""
21
21
22
- page_size = 10000
22
+ page_size = 2500
23
23
page_size_query_param = "page_size"
24
24
25
25
def get_next_page_number (self ) -> typing .Optional [int ]:
You can’t perform that action at this time.
0 commit comments