diff --git a/kinto/tests/support.py b/kinto/tests/support.py index 0e8220e859..4dd323eb38 100644 --- a/kinto/tests/support.py +++ b/kinto/tests/support.py @@ -10,8 +10,8 @@ from kinto import DEFAULT_SETTINGS -MINIMALIST_BUCKET = {'data': dict()} -MINIMALIST_COLLECTION = {'data': dict()} +MINIMALIST_BUCKET = {} +MINIMALIST_COLLECTION = {} MINIMALIST_GROUP = {'data': dict(members=['fxa:user'])} MINIMALIST_RECORD = {'data': dict(name="Hulled Barley", type="Whole Grain")} diff --git a/kinto/tests/test_views_buckets.py b/kinto/tests/test_views_buckets.py index 802edd05e4..2f3ad18de3 100644 --- a/kinto/tests/test_views_buckets.py +++ b/kinto/tests/test_views_buckets.py @@ -12,16 +12,14 @@ class BucketViewTest(BaseWebTest, unittest.TestCase): def setUp(self): super(BucketViewTest, self).setUp() - bucket = MINIMALIST_BUCKET.copy() resp = self.app.put_json(self.record_url, - bucket, + MINIMALIST_BUCKET, headers=self.headers) self.record = resp.json['data'] def test_buckets_are_global_to_every_users(self): self.app.patch_json(self.record_url, - {'data': {}, - 'permissions': {'read': [Authenticated]}}, + {'permissions': {'read': [Authenticated]}}, headers=self.headers) self.app.get(self.record_url, headers=get_user_headers('alice')) diff --git a/kinto/tests/test_views_groups.py b/kinto/tests/test_views_groups.py index 30f88f0215..2afe4fa776 100644 --- a/kinto/tests/test_views_groups.py +++ b/kinto/tests/test_views_groups.py @@ -161,7 +161,14 @@ def setUp(self): def test_groups_must_have_members_attribute(self): invalid = {} - self.app.put_json(self.group_url, - invalid, - headers=self.headers, - status=400) + resp = self.app.put_json(self.group_url, + invalid, + headers=self.headers, + status=400) + self.assertEqual(resp.json['message'], + "data is missing") + self.assertDictEqual(resp.json['details'][0], { + "description": "data is missing", + "location": "body", + "name": "data" + }) diff --git a/loadtests/loadtest/tutorial.py b/loadtests/loadtest/tutorial.py index f897f62b74..2ec9df75f2 100644 --- a/loadtests/loadtest/tutorial.py +++ b/loadtests/loadtest/tutorial.py @@ -139,21 +139,21 @@ def play_user_shared_bucket_tutorial(self): # Create a new bucket and check for permissions resp = self.session.put( - self.bucket_url(bucket_id), - data=json.dumps({'data': {}})) + self.bucket_url(bucket_id)) self.incr_counter("status-%s" % resp.status_code) # We should always have a 201 here. See mozilla-services/cliquet#367 # if resp.status_code == 200: # import pdb; pdb.set_trace() # self.assertEqual(resp.status_code, 201) record = resp.json() + print record self.assertIn('write', record['permissions']) # Create a new collection and check for permissions permissions = {"record:create": ['system.Authenticated']} resp = self.session.put( re.sub('/records$', '', collection_url), - data=json.dumps({'data': {}, 'permissions': permissions})) + data=json.dumps({'permissions': permissions})) self.incr_counter("status-%s" % resp.status_code) # We should always have a 201 here. See mozilla-services/cliquet#367 # if resp.status_code == 200: @@ -223,7 +223,7 @@ def play_user_shared_bucket_tutorial(self): permissions = {"group:create": ['system.Authenticated']} resp = self.session.put( self.bucket_url(bucket_id), - data=json.dumps({'data': {}, 'permissions': permissions})) + data=json.dumps({'permissions': permissions})) self.incr_counter("status-%s" % resp.status_code) self.assertEqual(resp.status_code, 200) record = resp.json()