mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-02-15 07:54:32 -05:00
Some tests use the `client` fixture but don’t call any of its methods. The reason for doing this is because the test depends on something in the request context. This commit replaces all those instances with `client_request`, which also sets the request context. These tests are the last ones that still use the `client` fixture. By replacing it with `client_request` we will be able to say that no tests should be using the `client` fixture directly.
21 lines
766 B
Python
21 lines
766 B
Python
from app.utils.pagination import generate_next_dict, generate_previous_dict
|
|
|
|
|
|
def test_generate_previous_dict(client_request):
|
|
result = generate_previous_dict('main.view_jobs', 'foo', 2, {})
|
|
assert 'page=1' in result['url']
|
|
assert result['title'] == 'Previous page'
|
|
assert result['label'] == 'page 1'
|
|
|
|
|
|
def test_generate_next_dict(client_request):
|
|
result = generate_next_dict('main.view_jobs', 'foo', 2, {})
|
|
assert 'page=3' in result['url']
|
|
assert result['title'] == 'Next page'
|
|
assert result['label'] == 'page 3'
|
|
|
|
|
|
def test_generate_previous_next_dict_adds_other_url_args(client_request):
|
|
result = generate_next_dict('main.view_notifications', 'foo', 2, {'message_type': 'blah'})
|
|
assert 'notifications/blah' in result['url']
|