File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -43,6 +43,31 @@ def test_compatibility_with_override_settings(self):
43
43
44
44
assert api_settings .PAGE_SIZE is None , "Setting should have been restored"
45
45
46
+ def test_pagination_settings (self ):
47
+ """
48
+ Integration tests for pagination system check.
49
+ """
50
+ from rest_framework .checks import pagination_system_check
51
+
52
+ def get_pagination_error (error_id : str ):
53
+ errors = pagination_system_check (app_configs = None )
54
+ return next ((error for error in errors if error .id == error_id ), None )
55
+
56
+ self .assertIsNone (api_settings .PAGE_SIZE )
57
+ self .assertIsNone (api_settings .DEFAULT_PAGINATION_CLASS )
58
+
59
+ pagination_error = get_pagination_error ('rest_framework.W001' )
60
+ self .assertIsNone (pagination_error )
61
+
62
+ with override_settings (REST_FRAMEWORK = {'PAGE_SIZE' : 10 }):
63
+ pagination_error = get_pagination_error ('rest_framework.W001' )
64
+ self .assertIsNotNone (pagination_error )
65
+
66
+ default_pagination_class = 'rest_framework.pagination.PageNumberPagination'
67
+ with override_settings (REST_FRAMEWORK = {'PAGE_SIZE' : 10 , 'DEFAULT_PAGINATION_CLASS' : default_pagination_class }):
68
+ pagination_error = get_pagination_error ('rest_framework.W001' )
69
+ self .assertIsNone (pagination_error )
70
+
46
71
47
72
class TestSettingTypes (TestCase ):
48
73
def test_settings_consistently_coerced_to_list (self ):
You can’t perform that action at this time.
0 commit comments