diff --git a/ckanext/datastore/tests/test_search.py b/ckanext/datastore/tests/test_search.py index 5fcded6d9d2..e2691ffd192 100644 --- a/ckanext/datastore/tests/test_search.py +++ b/ckanext/datastore/tests/test_search.py @@ -211,7 +211,7 @@ def test_search_filters(self): assert result['total'] == 1 assert result['records'] == [self.expected_records[0]] - def test_search_array_filters(self): + def test_search_filter_array_field(self): data = {'resource_id': self.data['resource_id'], 'filters': {u'characters': [u'Princess Anna', u'Sergius']}} postparams = '%s=1' % json.dumps(data) @@ -224,6 +224,19 @@ def test_search_array_filters(self): assert result['total'] == 1 assert result['records'] == [self.expected_records[0]] + def test_search_filter_normal_field_passing_multiple_values_in_array(self): + data = {'resource_id': self.data['resource_id'], + 'filters': {u'b\xfck': [u'annakarenina', u'warandpeace']}} + postparams = '%s=1' % json.dumps(data) + auth = {'Authorization': str(self.normal_user.apikey)} + res = self.app.post('/api/action/datastore_search', params=postparams, + extra_environ=auth) + res_dict = json.loads(res.body) + assert res_dict['success'] is True + result = res_dict['result'] + assert result['total'] == 2 + assert result['records'] == self.expected_records, result['records'] + def test_search_filters_get(self): filters = {u'b\xfck': 'annakarenina'} res = self.app.get('/api/action/datastore_search?resource_id={0}&filters={1}'.format(