aboutsummaryrefslogtreecommitdiff
path: root/backend/tests/test_histplorer.py
diff options
context:
space:
mode:
Diffstat (limited to 'backend/tests/test_histplorer.py')
-rw-r--r--backend/tests/test_histplorer.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/backend/tests/test_histplorer.py b/backend/tests/test_histplorer.py
index 8f7e281..cd52c67 100644
--- a/backend/tests/test_histplorer.py
+++ b/backend/tests/test_histplorer.py
@@ -1,5 +1,6 @@
import unittest
-import tempfile, os
+import tempfile
+import os
from tests.common import createTestDbTable
from histplorer import handleReq, HistDate, Event, ImgInfo, EventInfo, SuggResponse
@@ -105,8 +106,10 @@ class TestHandleReq(unittest.TestCase):
self.tempDir = tempfile.TemporaryDirectory()
self.dbFile = os.path.join(self.tempDir.name, 'data.db')
initTestDb(self.dbFile)
+
def tearDown(self):
self.tempDir.cleanup()
+
def test_events_req(self):
response = handleReq(self.dbFile, {'QUERY_STRING': 'type=events&range=-1999.2002-11-1&scale=1&incl=3&limit=2'})
self.assertEqual(response.events, [
@@ -123,6 +126,7 @@ class TestHandleReq(unittest.TestCase):
Event(1, 'event one', HistDate(None, 1900, 1, 1), None, None, None, 'event', 10, 11),
])
self.assertEqual(response.unitCounts, {-2000: 1, 1900: 2, 1990: 1})
+
def test_info_req(self):
response = handleReq(self.dbFile, {'QUERY_STRING': 'type=info&event=event%20three'})
self.assertEqual(response,
@@ -136,6 +140,7 @@ class TestHandleReq(unittest.TestCase):
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))