Skip to content

Commit

Permalink
Update tutoriel with load Cliquet version.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémy HUBSCHER committed Sep 9, 2015
1 parent 03065d7 commit 054dfea
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions loadtests/loadtest/tutorial.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)

0 comments on commit 054dfea

Please sign in to comment.