From 054dfea47618ddfa2b724c45a0c33654e76e159e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20HUBSCHER?= Date: Wed, 9 Sep 2015 14:24:29 +0200 Subject: [PATCH] Update tutoriel with load Cliquet version. --- loadtests/loadtest/tutorial.py | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/loadtests/loadtest/tutorial.py b/loadtests/loadtest/tutorial.py index 23a268b7d..b44f15d98 100644 --- a/loadtests/loadtest/tutorial.py +++ b/loadtests/loadtest/tutorial.py @@ -134,7 +134,8 @@ def play_user_default_bucket_tutorial(self): def play_user_shared_bucket_tutorial(self): bucket_id = 'bucket-%s' % uuid.uuid4() - collection_url = self.collection_url(bucket_id, 'tasks') + collection_id = 'tasks-%s' % uuid.uuid4() + collection_url = self.collection_url(bucket_id, collection_id) # Create a new bucket and check for permissions resp = self.session.put( @@ -189,17 +190,9 @@ def play_user_shared_bucket_tutorial(self): bob_user_id = record['permissions']['write'][0] bob_task_id = record['data']['id'] - # XXX: Allow bob to read his record. See Kinto#182 - resp = self.session.patch( - self.record_url(bob_task_id, bucket_id, 'tasks'), - data=json.dumps({'permissions': {'read': [bob_user_id]}}), - auth=bob_auth) - self.incr_counter("status-%s" % resp.status_code) - self.assertEqual(resp.status_code, 200) - # Share Alice's task with Bob resp = self.session.patch( - self.record_url(alice_task_id, bucket_id, 'tasks'), + self.record_url(alice_task_id, bucket_id, collection_id), data=json.dumps({'permissions': {'read': [bob_user_id]}}), auth=alice_auth) self.incr_counter("status-%s" % resp.status_code) @@ -210,7 +203,7 @@ def play_user_shared_bucket_tutorial(self): # Check that Bob can access it resp = self.session.get( - self.record_url(alice_task_id, bucket_id, 'tasks'), + self.record_url(alice_task_id, bucket_id, collection_id), auth=bob_auth) self.incr_counter("status-%s" % resp.status_code) self.assertEqual(resp.status_code, 200) @@ -249,7 +242,7 @@ def play_user_shared_bucket_tutorial(self): # Give Alice's task permission for that group group_id = self.group_url(bucket_id, 'alices-friends', False) resp = self.session.patch( - self.record_url(alice_task_id, bucket_id, 'tasks'), + self.record_url(alice_task_id, bucket_id, collection_id), data=json.dumps({'permissions': {'read': [group_id]}}), auth=alice_auth) self.incr_counter("status-%s" % resp.status_code) @@ -259,7 +252,7 @@ def play_user_shared_bucket_tutorial(self): # Try to access Alice's task with Mary resp = self.session.get( - self.record_url(alice_task_id, bucket_id, 'tasks'), + self.record_url(alice_task_id, bucket_id, collection_id), auth=mary_auth) self.incr_counter("status-%s" % resp.status_code) self.assertEqual(resp.status_code, 200) @@ -287,4 +280,4 @@ def check_for_lists(self): resp = self.session.get( self.api_url('buckets')) self.incr_counter("status-%s" % resp.status_code) - self.assertEqual(resp.status_code, 403) + self.assertEqual(resp.status_code, 200)