Skip to content

Commit

Permalink
Add failing tests that refs #461
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémy HUBSCHER authored and leplatrem committed Mar 7, 2016
1 parent 24a1100 commit 223b062
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
8 changes: 8 additions & 0 deletions kinto/tests/test_views_buckets.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,14 @@ def test_buckets_name_should_be_simple(self):
headers=self.headers,
status=400)

def test_buckets_should_reject_unaccepted_request_content_type(self):
headers = self.headers.copy()
headers['Content-Type'] = 'text/plain'
self.app.put('/buckets/beers',
MINIMALIST_BUCKET,
headers=headers,
status=415)

def test_create_permissions_can_be_added_on_buckets(self):
bucket = MINIMALIST_BUCKET.copy()
bucket['permissions'] = {'collection:create': ['fxa:user'],
Expand Down
8 changes: 8 additions & 0 deletions kinto/tests/test_views_collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ def test_collections_name_should_be_simple(self):
headers=self.headers,
status=400)

def test_collections_should_reject_unaccepted_request_content_type(self):
headers = self.headers.copy()
headers['Content-Type'] = 'text/plain'
self.app.put('/buckets/beers/collections/barley',
MINIMALIST_COLLECTION,
headers=headers,
status=415)

def test_unknown_bucket_raises_403(self):
other_bucket = self.collections_url.replace('beers', 'sodas')
self.app.get(other_bucket, headers=self.headers, status=403)
Expand Down
8 changes: 8 additions & 0 deletions kinto/tests/test_views_groups.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ def test_groups_name_should_be_simple(self):
headers=self.headers,
status=400)

def test_groups_should_reject_unaccepted_request_content_type(self):
headers = self.headers.copy()
headers['Content-Type'] = 'text/plain'
self.app.put('/buckets/beers/groups/moderator',
MINIMALIST_GROUP,
headers=headers,
status=415)

def test_unknown_bucket_raises_403(self):
other_bucket = self.collection_url.replace('beers', 'sodas')
self.app.get(other_bucket, headers=self.headers, status=403)
Expand Down
9 changes: 9 additions & 0 deletions kinto/tests/test_views_records.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,3 +203,12 @@ def test_record_is_accessible_by_group_member(self):
self.app.get(self.record_url,
headers=self.aaron_headers,
status=200)

def test_records_should_reject_unaccepted_request_content_type(self):
headers = self.headers.copy()
headers['Content-Type'] = 'text/plain'
self.app.put(self.record_url,
MINIMALIST_RECORD,
headers=headers,
status=415)

0 comments on commit 223b062

Please sign in to comment.