Compare commits

...

5 commits

Author SHA1 Message Date
Simon Willison
db23da7ae1
Add primary keys back to order by clause for sorting, refs #216 2018-04-16 18:39:16 -07:00
Simon Willison
59a3aa859c
Print more information on failing test 2018-04-16 17:37:57 -07:00
Simon Willison
97cf5151ba
pip install test dependencies 2018-04-16 17:34:47 -07:00
Simon Willison
00de2e8235
Run python setup.py install first 2018-04-16 17:28:37 -07:00
Simon Willison
2aa9d4a097
Run pytest -vv in Travis 2018-04-16 17:27:11 -07:00
3 changed files with 10 additions and 2 deletions

View file

@ -5,4 +5,4 @@ python:
- 3.6
script:
- python setup.py test
- pip install pytest aiohttp beautifulsoup4 && python setup.py install && pytest -vv

View file

@ -619,9 +619,11 @@ class TableView(RowTableShared):
if use_rowid:
select = 'rowid, *'
order_by = 'rowid'
order_by_pks = 'rowid'
else:
select = '*'
order_by = ', '.join(pks)
order_by_pks = ', '.join([escape_sqlite(pk) for pk in pks])
order_by = order_by_pks
if is_view:
order_by = ''
@ -792,6 +794,9 @@ class TableView(RowTableShared):
)
)
params['p{}'.format(len(params))] = sort_value
order_by = '{}, {}'.format(
order_by, order_by_pks
)
else:
where_clauses.extend(next_by_pk_clauses)

View file

@ -460,6 +460,9 @@ def test_sortable(app_client, query_string, sort_key, human_description_en):
assert 5 == page
expected = list(generate_sortable_rows(201))
expected.sort(key=sort_key)
import json
print('expected = {}'.format(json.dumps(expected)))
print('fetched = {}'.format(json.dumps(fetched)))
assert [
r['content'] for r in expected
] == [