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']

from app.utils.pagination import generate_next_dict, generate_previous_dict


def test_generate_previous_dict(client):
    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):
    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):
    result = generate_next_dict('main.view_notifications', 'foo', 2, {'message_type': 'blah'})
    assert 'notifications/blah' in result['url']

Clarify variable name in pagination tests
Clarify variable name in pagination tests

We should avoid using abbreviations, as they aren't universally
understood i.e. they're not worth the small saving in typing.
