diff options
| author | Terry Truong <terry06890@gmail.com> | 2023-01-05 17:13:03 +1100 |
|---|---|---|
| committer | Terry Truong <terry06890@gmail.com> | 2023-01-05 17:23:39 +1100 |
| commit | 442c0bbffc5c372c7ec3510914968f75ab6e4a4f (patch) | |
| tree | bc3ae52ec3954ce574961bce9d64f2d02516d18b /backend/tests/test_histplorer.py | |
| parent | a3b13e700d8d65e27c1d90960b6ab6292e433c2c (diff) | |
Add partially-complete search modal
For now, use placeholder code for jumping to a search result.
Add db index for case-insensitive event title searching.
Make type=info requests accept title instead of ID (for looking up a searched-for title).
Make EventInfo contain an Event field (for showing info in search suggestions).
Add titleToEvent map in App, for use by SearchModal to look up searched-for titles.
Add keyboard shortcuts to open/close search and info modals.
Diffstat (limited to 'backend/tests/test_histplorer.py')
| -rw-r--r-- | backend/tests/test_histplorer.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/backend/tests/test_histplorer.py b/backend/tests/test_histplorer.py index b3f7cb4..fcaafb5 100644 --- a/backend/tests/test_histplorer.py +++ b/backend/tests/test_histplorer.py @@ -124,12 +124,18 @@ class TestHandleReq(unittest.TestCase): ]) self.assertEqual(response.unitCounts, {-2000: 1, 1900: 2, 1990: 1}) def test_info_req(self): - response = handleReq(self.dbFile, {'QUERY_STRING': 'type=info&event=3'}) + response = handleReq(self.dbFile, {'QUERY_STRING': 'type=info&event=event%20three'}) self.assertEqual(response, - EventInfo('desc three', 300, ImgInfo('example.com/3', 'cc-by-sa 3.0', 'artist three', 'credits three'))) - response = handleReq(self.dbFile, {'QUERY_STRING': 'type=info&event=4'}) + EventInfo( + Event(3, 'event three', HistDate(True, 1990, 10, 10), HistDate(True, 2000, 10, 10), None, None, + 'discovery', 30, 0), + 'desc three', 300, ImgInfo('example.com/3', 'cc-by-sa 3.0', 'artist three', 'credits three'))) + response = handleReq(self.dbFile, {'QUERY_STRING': 'type=info&event=event%20four'}) self.assertEqual(response, - EventInfo('desc four', 400, ImgInfo('example.com/2', 'cc-by', 'artist two', 'credits two'))) + EventInfo( + Event(4, 'event four', HistDate(False, -2000, 10, 10), None, HistDate(False, 1, 10, 10), None, + 'event', 20, 1000), + 'desc four', 400, ImgInfo('example.com/2', 'cc-by', 'artist two', 'credits two'))) def test_sugg_req(self): response = handleReq(self.dbFile, {'QUERY_STRING': 'type=sugg&input=event t'}) self.assertEqual(response, SuggResponse(['event two', 'event three'], False)) |
