summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/tests.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index 1d211c91b..122f29d92 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -236,6 +236,24 @@ class UtilsTest(TestCase):
self.assertEqual(response.status_code, 302)
+class SearchText:
+ SEARCH_URL = ''
+
+ def _test_search(self, client, result, context=""):
+ assert self.SEARCH_URL
+ for q, expected_result in result:
+ search = {'search_vector': q}
+ response = client.get(reverse(self.SEARCH_URL), search)
+ self.assertEqual(response.status_code, 200)
+ res = json.loads(response.content.decode())
+ msg = "{} result(s) where expected for search: {} - found {}" \
+ "".format(expected_result, q, res['recordsTotal'])
+ if context:
+ msg = context + " - " + msg
+ self.assertEqual(res['recordsTotal'], expected_result,
+ msg=msg)
+
+
class CommandsTestCase(TestCase):
fixtures = [settings.ROOT_PATH +
'../ishtar_common/fixtures/test_towns.json']