From 2676bb233e02628ab4587082560ad9d17482fafb Mon Sep 17 00:00:00 2001 From: joetsoi Date: Mon, 1 Jul 2013 10:43:12 +0100 Subject: [PATCH] [#953] fix datastore tests create an organization in setup and use it in package_create --- ckanext/datastore/tests/test_search.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ckanext/datastore/tests/test_search.py b/ckanext/datastore/tests/test_search.py index a47735e7149..db330293938 100644 --- a/ckanext/datastore/tests/test_search.py +++ b/ckanext/datastore/tests/test_search.py @@ -49,6 +49,12 @@ def setup_class(cls): res_dict = json.loads(res.body) assert res_dict['success'] is True + # Make an organization, because private datasets must belong to one. + cls.organization = tests.call_action_api( + cls.app, 'organization_create', + name='test_org', + apikey=cls.sysadmin_user.apikey) + cls.expected_records = [{u'published': u'2005-03-01T00:00:00', u'_id': 1, u'nested': [u'b', {u'moo': u'moo'}], @@ -106,6 +112,7 @@ def test_search_private_dataset(self): context, {'name': 'privatedataset', 'private': True, + 'owner_org' : self.organization['id'], 'groups': [{ 'id': group.id }]}) @@ -503,6 +510,12 @@ def setup_class(cls): extra_environ=auth) res_dict = json.loads(res.body) assert res_dict['success'] is True + + # Make an organization, because private datasets must belong to one. + cls.organization = tests.call_action_api( + cls.app, 'organization_create', + name='test_org', + apikey=cls.sysadmin_user.apikey) cls.expected_records = [{u'_full_text': u"'annakarenina':1 'b':3 'moo':4 'tolstoy':2", u'_id': 1, @@ -637,6 +650,7 @@ def test_new_datastore_table_from_private_resource(self): context, {'name': 'privatedataset', 'private': True, + 'owner_org': self.organization['id'], 'groups': [{ 'id': group.id }]}) @@ -676,6 +690,7 @@ def test_making_resource_private_makes_datastore_private(self): context, {'name': 'privatedataset2', 'private': False, + 'owner_org': self.organization['id'], 'groups': [{ 'id': group.id }]})