From 217c2969cf388e9a8ef553e79b86e264c3b2467d Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Wed, 12 Feb 2020 22:24:05 -0800 Subject: [PATCH] Update facet tests --- tests/test_api.py | 18 +++++++-------- tests/test_facets.py | 54 ++++++++++++++++++++++---------------------- tests/test_html.py | 8 +++---- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/tests/test_api.py b/tests/test_api.py index 27fa26bb..9a9aa6fe 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -1319,8 +1319,8 @@ def test_page_size_matching_max_returned_rows( { "state": { "name": "state", - "hideable": True, "type": "column", + "hideable": True, "toggle_url": "/fixtures/facetable.json?_facet=city_id", "results": [ { @@ -1349,8 +1349,8 @@ def test_page_size_matching_max_returned_rows( }, "city_id": { "name": "city_id", - "hideable": True, "type": "column", + "hideable": True, "toggle_url": "/fixtures/facetable.json?_facet=state", "results": [ { @@ -1360,13 +1360,6 @@ def test_page_size_matching_max_returned_rows( "toggle_url": "_facet=state&_facet=city_id&city_id=1", "selected": False, }, - { - "value": 2, - "label": "Los Angeles", - "count": 4, - "toggle_url": "_facet=state&_facet=city_id&city_id=2", - "selected": False, - }, { "value": 3, "label": "Detroit", @@ -1374,6 +1367,13 @@ def test_page_size_matching_max_returned_rows( "toggle_url": "_facet=state&_facet=city_id&city_id=3", "selected": False, }, + { + "value": 2, + "label": "Los Angeles", + "count": 4, + "toggle_url": "_facet=state&_facet=city_id&city_id=2", + "selected": False, + }, { "value": 4, "label": "Memnonia", diff --git a/tests/test_facets.py b/tests/test_facets.py index e3dc3df3..68209979 100644 --- a/tests/test_facets.py +++ b/tests/test_facets.py @@ -115,13 +115,6 @@ async def test_column_facet_results(app_client): "toggle_url": "http://localhost/?_facet=city_id&city_id=1", "selected": False, }, - { - "value": 2, - "label": "Los Angeles", - "count": 4, - "toggle_url": "http://localhost/?_facet=city_id&city_id=2", - "selected": False, - }, { "value": 3, "label": "Detroit", @@ -129,6 +122,13 @@ async def test_column_facet_results(app_client): "toggle_url": "http://localhost/?_facet=city_id&city_id=3", "selected": False, }, + { + "value": 2, + "label": "Los Angeles", + "count": 4, + "toggle_url": "http://localhost/?_facet=city_id&city_id=2", + "selected": False, + }, { "value": 4, "label": "Memnonia", @@ -168,13 +168,6 @@ async def test_column_facet_from_metadata_cannot_be_hidden(app_client): "toggle_url": "http://localhost/?city_id=1", "selected": False, }, - { - "value": 2, - "label": "Los Angeles", - "count": 4, - "toggle_url": "http://localhost/?city_id=2", - "selected": False, - }, { "value": 3, "label": "Detroit", @@ -182,6 +175,13 @@ async def test_column_facet_from_metadata_cannot_be_hidden(app_client): "toggle_url": "http://localhost/?city_id=3", "selected": False, }, + { + "value": 2, + "label": "Los Angeles", + "count": 4, + "toggle_url": "http://localhost/?city_id=2", + "selected": False, + }, { "value": 4, "label": "Memnonia", @@ -253,13 +253,6 @@ async def test_array_facet_results(app_client): "toggle_url": "http://localhost/?_facet_array=tags&tags__arraycontains=tag1", "selected": False, }, - { - "value": "tag2", - "label": "tag2", - "count": 1, - "toggle_url": "http://localhost/?_facet_array=tags&tags__arraycontains=tag2", - "selected": False, - }, { "value": "tag3", "label": "tag3", @@ -267,6 +260,13 @@ async def test_array_facet_results(app_client): "toggle_url": "http://localhost/?_facet_array=tags&tags__arraycontains=tag3", "selected": False, }, + { + "value": "tag2", + "label": "tag2", + "count": 1, + "toggle_url": "http://localhost/?_facet_array=tags&tags__arraycontains=tag2", + "selected": False, + }, ], "hideable": True, "toggle_url": "/", @@ -292,10 +292,10 @@ async def test_date_facet_results(app_client): "type": "date", "results": [ { - "value": "2019-01-14", - "label": "2019-01-14", + "value": "2019-01-17", + "label": "2019-01-17", "count": 4, - "toggle_url": "http://localhost/?_facet_date=created&created__date=2019-01-14", + "toggle_url": "http://localhost/?_facet_date=created&created__date=2019-01-17", "selected": False, }, { @@ -306,10 +306,10 @@ async def test_date_facet_results(app_client): "selected": False, }, { - "value": "2019-01-17", - "label": "2019-01-17", + "value": "2019-01-14", + "label": "2019-01-14", "count": 4, - "toggle_url": "http://localhost/?_facet_date=created&created__date=2019-01-17", + "toggle_url": "http://localhost/?_facet_date=created&created__date=2019-01-14", "selected": False, }, { diff --git a/tests/test_html.py b/tests/test_html.py index 823d7c9a..33e6d2e1 100644 --- a/tests/test_html.py +++ b/tests/test_html.py @@ -371,13 +371,13 @@ def test_facet_display(app_client): "count": 6, }, { - "name": "Los Angeles", - "qs": "_facet=planet_int&_facet=city_id&_facet=on_earth&city_id=2", + "name": "Detroit", + "qs": "_facet=planet_int&_facet=city_id&_facet=on_earth&city_id=3", "count": 4, }, { - "name": "Detroit", - "qs": "_facet=planet_int&_facet=city_id&_facet=on_earth&city_id=3", + "name": "Los Angeles", + "qs": "_facet=planet_int&_facet=city_id&_facet=on_earth&city_id=2", "count": 4, }, {