Skip to content
This repository was archived by the owner on Dec 16, 2025. It is now read-only.

Commit 55d51d7

Browse files
committed
fix(test_add_pagination): parse generated pagination links to test assertion
1 parent 25a27b8 commit 55d51d7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

tests/test_sqlalchemy_data_layer.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# -*- coding: utf-8 -*-
22

3-
from six.moves.urllib.parse import urlencode
3+
from six.moves.urllib.parse import urlencode, parse_qs
44
import pytest
55

66
from sqlalchemy import create_engine, Column, Integer, DateTime, String, ForeignKey
@@ -332,9 +332,11 @@ def test_add_pagination_links(app):
332332
with app.app_context():
333333
qs = {'page[number]': '2', 'page[size]': '10'}
334334
qsm = QSManager(qs, None)
335-
pagination_data = dict()
336-
add_pagination_links(pagination_data, 43, qsm, str())
337-
assert pagination_data['links']['last'] == '?page%5Bsize%5D=10&page%5Bnumber%5D=5'
335+
pagination_dict = dict()
336+
add_pagination_links(pagination_dict, 43, qsm, str())
337+
last_page_dict = parse_qs(pagination_dict['links']['last'][1:])
338+
assert len(last_page_dict['page[number]']) == 1
339+
assert last_page_dict['page[number]'][0] == '5'
338340

339341
def test_Node(person_model, person_schema, monkeypatch):
340342
from copy import deepcopy

0 commit comments

Comments
 (0)