Skip to content

Commit

Permalink
[api package search tests] Updated some tests to consider flexible tags.
Browse files Browse the repository at this point in the history
  • Loading branch information
icmurray committed Nov 15, 2011
1 parent d8005ef commit ec768f4
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions ckan/tests/functional/api/test_package_search.py
Expand Up @@ -200,16 +200,16 @@ def teardown_class(cls):
search.clear()

def test_07_uri_qjson_tags(self):
query = {'q': '', 'tags':['tolstoy']}
query = {'q': '', 'tags':['Flexible \u0489!']}
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
self.assert_results(res_dict, [u'annakarenina', u'warandpeace'])
assert res_dict['count'] == 2, res_dict

def test_07_uri_qjson_tags_multiple(self):
query = {'q': '', 'tags':['tolstoy', 'russian']}
query = {'q': '', 'tags':['tolstoy', 'russian', u'Flexible \u0489!']}
json_query = self.dumps(query)
offset = self.base_url + '?qjson=%s' % json_query
print offset
Expand Down Expand Up @@ -355,6 +355,15 @@ def test_07_uri_qjson_tags(self):
self.assert_results(res_dict, [u'annakarenina'])
assert res_dict['count'] == 1, res_dict

def test_07_uri_qjson_tags_with_unicode(self):
query = {'q': u'tags:"Flexible \u0489\\!"'}
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', u'warandpeace'])
assert res_dict['count'] == 2, res_dict

def test_07_uri_qjson_tags_multiple(self):
query = {'q': 'tags:tolstoy tags:russian'}
json_query = self.dumps(query)
Expand Down

0 comments on commit ec768f4

Please sign in to comment.