mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-27 20:14:01 +03:00
tests: fix the tests to validate the two new keys for page links
This commit is contained in:
parent
81439bb646
commit
ec50399fe5
|
@ -47,6 +47,8 @@ class TestPaginationIntegration:
|
||||||
'results': [12, 14, 16, 18, 20],
|
'results': [12, 14, 16, 18, 20],
|
||||||
'previous': 'http://testserver/',
|
'previous': 'http://testserver/',
|
||||||
'next': 'http://testserver/?page=3',
|
'next': 'http://testserver/?page=3',
|
||||||
|
'last': 'http://testserver/?page=10',
|
||||||
|
'first': None,
|
||||||
'count': 50
|
'count': 50
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,6 +63,8 @@ class TestPaginationIntegration:
|
||||||
'results': [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],
|
'results': [2, 4, 6, 8, 10, 12, 14, 16, 18, 20],
|
||||||
'previous': None,
|
'previous': None,
|
||||||
'next': 'http://testserver/?page=2&page_size=10',
|
'next': 'http://testserver/?page=2&page_size=10',
|
||||||
|
'last': 'http://testserver/?page=5&page_size=10',
|
||||||
|
'first': None,
|
||||||
'count': 50
|
'count': 50
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,6 +83,8 @@ class TestPaginationIntegration:
|
||||||
],
|
],
|
||||||
'previous': None,
|
'previous': None,
|
||||||
'next': 'http://testserver/?page=2&page_size=1000',
|
'next': 'http://testserver/?page=2&page_size=1000',
|
||||||
|
'last': 'http://testserver/?page=3&page_size=1000',
|
||||||
|
'first': None,
|
||||||
'count': 50
|
'count': 50
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +99,8 @@ class TestPaginationIntegration:
|
||||||
'results': [2, 4, 6, 8, 10],
|
'results': [2, 4, 6, 8, 10],
|
||||||
'previous': None,
|
'previous': None,
|
||||||
'next': 'http://testserver/?page=2&page_size=0',
|
'next': 'http://testserver/?page=2&page_size=0',
|
||||||
|
'last': 'http://testserver/?page=10&page_size=0',
|
||||||
|
'first': None,
|
||||||
'count': 50
|
'count': 50
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,6 +110,8 @@ class TestPaginationIntegration:
|
||||||
assert response.status_code == status.HTTP_200_OK
|
assert response.status_code == status.HTTP_200_OK
|
||||||
assert response.data == {
|
assert response.data == {
|
||||||
'results': [12, 14, 16, 18, 20],
|
'results': [12, 14, 16, 18, 20],
|
||||||
|
'last': 'http://testserver/?filter=even&page=10',
|
||||||
|
'first': None,
|
||||||
'previous': 'http://testserver/?filter=even',
|
'previous': 'http://testserver/?filter=even',
|
||||||
'next': 'http://testserver/?filter=even&page=3',
|
'next': 'http://testserver/?filter=even&page=3',
|
||||||
'count': 50
|
'count': 50
|
||||||
|
@ -114,7 +124,9 @@ class TestPaginationIntegration:
|
||||||
assert response.data == {
|
assert response.data == {
|
||||||
'results': [12, 14, 16, 18, 20],
|
'results': [12, 14, 16, 18, 20],
|
||||||
'previous': 'http://testserver/?filter=',
|
'previous': 'http://testserver/?filter=',
|
||||||
|
'last': 'http://testserver/?filter=&page=10',
|
||||||
'next': 'http://testserver/?filter=&page=3',
|
'next': 'http://testserver/?filter=&page=3',
|
||||||
|
'first': None,
|
||||||
'count': 50
|
'count': 50
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +203,8 @@ class TestPageNumberPagination:
|
||||||
'results': [1, 2, 3, 4, 5],
|
'results': [1, 2, 3, 4, 5],
|
||||||
'previous': None,
|
'previous': None,
|
||||||
'next': 'http://testserver/?page=2',
|
'next': 'http://testserver/?page=2',
|
||||||
|
'last': 'http://testserver/?page=20',
|
||||||
|
'first': None,
|
||||||
'count': 100
|
'count': 100
|
||||||
}
|
}
|
||||||
assert context == {
|
assert context == {
|
||||||
|
@ -217,6 +231,8 @@ class TestPageNumberPagination:
|
||||||
'results': [6, 7, 8, 9, 10],
|
'results': [6, 7, 8, 9, 10],
|
||||||
'previous': 'http://testserver/',
|
'previous': 'http://testserver/',
|
||||||
'next': 'http://testserver/?page=3',
|
'next': 'http://testserver/?page=3',
|
||||||
|
'last': 'http://testserver/?page=20',
|
||||||
|
'first': None,
|
||||||
'count': 100
|
'count': 100
|
||||||
}
|
}
|
||||||
assert context == {
|
assert context == {
|
||||||
|
@ -240,6 +256,8 @@ class TestPageNumberPagination:
|
||||||
assert content == {
|
assert content == {
|
||||||
'results': [96, 97, 98, 99, 100],
|
'results': [96, 97, 98, 99, 100],
|
||||||
'previous': 'http://testserver/?page=19',
|
'previous': 'http://testserver/?page=19',
|
||||||
|
'first': 'http://testserver/?page=1',
|
||||||
|
'last': None,
|
||||||
'next': None,
|
'next': None,
|
||||||
'count': 100
|
'count': 100
|
||||||
}
|
}
|
||||||
|
@ -336,6 +354,8 @@ class TestPageNumberPaginationOverride:
|
||||||
'results': [1, ],
|
'results': [1, ],
|
||||||
'previous': None,
|
'previous': None,
|
||||||
'next': None,
|
'next': None,
|
||||||
|
'last': None,
|
||||||
|
'first': None,
|
||||||
'count': 1
|
'count': 1
|
||||||
}
|
}
|
||||||
assert context == {
|
assert context == {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user