コード例 #1
0
def test_limit_offset_filtered_offset(client):
    response = client.get('/limit_offset_widgets?size=2&offset=1')

    assert helpers.get_data(response) == [
        {
            'id': '5',
            'size': 2,
        },
    ]
    assert helpers.get_meta(response) == {
        'has_next_page': False
    }
コード例 #2
0
def test_limit_offset_offset_truncate(client):
    response = client.get('/limit_offset_widgets?offset=5')

    assert helpers.get_data(response) == [
        {
            'id': '6',
            'size': 3,
        },
    ]
    assert helpers.get_meta(response) == {
        'has_next_page': False
    }
コード例 #3
0
def test_page_default(client):
    response = client.get('/page_widgets')

    assert helpers.get_data(response) == [
        {
            'id': '1',
            'size': 1,
        },
        {
            'id': '2',
            'size': 2,
        },
    ]
    assert helpers.get_meta(response) == {
        'has_next_page': True
    }
コード例 #4
0
def test_page(client):
    response = client.get('/page_widgets?page=1')

    assert helpers.get_data(response) == [
        {
            'id': '3',
            'size': 3,
        },
        {
            'id': '4',
            'size': 1,
        },
    ]
    assert helpers.get_meta(response) == {
        'has_next_page': True
    }
コード例 #5
0
def test_limit_offset_offset(client):
    response = client.get('/limit_offset_widgets?offset=2')

    assert helpers.get_data(response) == [
        {
            'id': '3',
            'size': 3,
        },
        {
            'id': '4',
            'size': 1,
        },
    ]
    assert helpers.get_meta(response) == {
        'has_next_page': True
    }
コード例 #6
0
def test_id_cursor_sorted_default(client):
    response = client.get('/id_cursor_widgets?sort=size,-id')

    assert helpers.get_data(response) == [
        {
            'id': '4',
            'size': 1,
        },
        {
            'id': '1',
            'size': 1,
        },
    ]
    assert helpers.get_meta(response) == {
        'has_next_page': True,
        'cursors': [
            'WzEsIDRd',
            'WzEsIDFd',
        ],
    }
コード例 #7
0
def test_id_cursor_default(client):
    response = client.get('/id_cursor_widgets')

    assert helpers.get_data(response) == [
        {
            'id': '1',
            'size': 1,
        },
        {
            'id': '2',
            'size': 2,
        },
    ]
    assert helpers.get_meta(response) == {
        'has_next_page': True,
        'cursors': [
            'WzFd',
            'WzJd',
        ],
    }
コード例 #8
0
def meta(url):
    html_tree = helpers.open_url(url)
    meta = helpers.get_meta(html_tree)
    dict = {'meta': meta}
    return jsonify(dict)