Skip to content
This repository has been archived by the owner on Mar 28, 2019. It is now read-only.

Commit

Permalink
Incorrect response code.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rémy HUBSCHER committed Feb 25, 2016
1 parent 4d38784 commit dc21c44
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions cliquet/tests/resource/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,7 @@ def test_invalid_accept_header_on_collections_returns_406(self):
'',
headers=headers,
status=406)
self.assertEqual(resp.json['code'], 406)
message = "Accept header should be one of ['application/json']"
self.assertEqual(resp.json['message'], message)

Expand All @@ -403,6 +404,7 @@ def test_invalid_content_type_header_on_collections_returns_415(self):
'',
headers=headers,
status=415)
self.assertEqual(resp.json['code'], 415)
message = "Content-Type header should be one of ['application/json']"
self.assertEqual(resp.json['message'], message)

Expand All @@ -412,16 +414,20 @@ def test_invalid_accept_header_on_record_returns_406(self):
resp = self.app.get(self.get_item_url(),
headers=headers,
status=406)
self.assertEqual(resp.json['code'], 406)
message = "Accept header should be one of ['application/json']"
self.assertEqual(resp.json['message'], message)

def test_invalid_content_type_header_on_record_returns_415(self):
headers = self.headers.copy()
headers['Content-Type'] = 'text/plain'
self.app.patch_json(self.get_item_url(),
'',
headers=headers,
status=415)
resp = self.app.patch_json(self.get_item_url(),
'',
headers=headers,
status=415)
self.assertEqual(resp.json['code'], 415)
message = "Accept header should be one of ['application/json']"
self.assertEqual(resp.json['message'], message)


class IgnoredFieldsTest(BaseWebTest, unittest.TestCase):
Expand Down

0 comments on commit dc21c44

Please sign in to comment.