mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-22 17:08:44 -04:00
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
21 lines
712 B
Python
21 lines
712 B
Python
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']
|