mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-23 15:57:23 -04:00
Move pagination utils into own module
This continues the pattern established in [1], just to chip away a bit more at the random collection of stuff in utils/__init__.py. [1]: https://github.com/alphagov/notifications-admin/pull/3923
This commit is contained in:
20
tests/app/utils/test_pagination.py
Normal file
20
tests/app/utils/test_pagination.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from app.utils.pagination import generate_next_dict, generate_previous_dict
|
||||
|
||||
|
||||
def test_generate_previous_dict(client):
|
||||
ret = generate_previous_dict('main.view_jobs', 'foo', 2, {})
|
||||
assert 'page=1' in ret['url']
|
||||
assert ret['title'] == 'Previous page'
|
||||
assert ret['label'] == 'page 1'
|
||||
|
||||
|
||||
def test_generate_next_dict(client):
|
||||
ret = generate_next_dict('main.view_jobs', 'foo', 2, {})
|
||||
assert 'page=3' in ret['url']
|
||||
assert ret['title'] == 'Next page'
|
||||
assert ret['label'] == 'page 3'
|
||||
|
||||
|
||||
def test_generate_previous_next_dict_adds_other_url_args(client):
|
||||
ret = generate_next_dict('main.view_notifications', 'foo', 2, {'message_type': 'blah'})
|
||||
assert 'notifications/blah' in ret['url']
|
||||
Reference in New Issue
Block a user