diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-11-12 12:17:49 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2020-11-12 12:17:49 +0100 |
commit | 4e73dc56a822b09a2a4e0b9b66fb64dd8120c670 (patch) | |
tree | b719392d4d650776e454fc073c0a13e928eafe9d /ishtar_common/tests.py | |
parent | 93566f3d94d4c4b35329446f04d4960b7c8be01c (diff) | |
download | Ishtar-4e73dc56a822b09a2a4e0b9b66fb64dd8120c670.tar.bz2 Ishtar-4e73dc56a822b09a2a4e0b9b66fb64dd8120c670.zip |
Tests: search hierarchic text test
Diffstat (limited to 'ishtar_common/tests.py')
-rw-r--r-- | ishtar_common/tests.py | 18 |
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'] |