From 98f2a828d6913ea96f6b1027788da571ba82b3ea Mon Sep 17 00:00:00 2001 From: Ian Murray Date: Mon, 21 Nov 2011 15:56:10 +0000 Subject: [PATCH] [test_package_search] A couple more tests tag search tests --- ckan/tests/functional/api/test_package_search.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ckan/tests/functional/api/test_package_search.py b/ckan/tests/functional/api/test_package_search.py index cfa31dc6a1c..4e98de1090a 100644 --- a/ckan/tests/functional/api/test_package_search.py +++ b/ckan/tests/functional/api/test_package_search.py @@ -202,6 +202,15 @@ def teardown_class(cls): search.clear() def test_07_uri_qjson_tags(self): + query = {'q': '', 'tags':['tolstoy']} + json_query = self.dumps(query) + offset = self.base_url + '?qjson=%s' % json_query + res = self.app.get(offset, status=200) + res_dict = self.data_from_res(res) + self.assert_results(res_dict, [u'annakarenina']) + assert res_dict['count'] == 1, res_dict + + def test_07_uri_qjson_tags_with_flexible_query(self): query = {'q': '', 'tags':['Flexible \u30a1']} json_query = self.dumps(query) offset = self.base_url + '?qjson=%s' % json_query @@ -301,6 +310,13 @@ def test_10_single_tag_with_plus(self): res_dict = self.data_from_res(res) assert res_dict['count'] == 2, res_dict + def test_10_multi_tags_with_ampersand_including_a_multiword_tagame(self): + tagname = "Flexible+" + quote(u'\u30a1'.encode('utf8')) + offset = self.base_url + '?tags=tolstoy&tags=%s&all_fields=1' % tagname + res = self.app.get(offset, status=200) + res_dict = self.data_from_res(res) + assert res_dict['count'] == 1, res_dict + def test_10_multiple_tags_with_ampersand(self): offset = self.base_url + '?tags=tolstoy&tags=russian&all_fields=1' res = self.app.get(offset, status=200)