diff options
author | Jenkins <jenkins@review.openstack.org> | 2015-08-07 09:28:25 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2015-08-07 09:28:25 +0000 |
commit | 7784cc73b1905f8038249b071d3c766ef6180b1f (patch) | |
tree | 53b75250084b034e943f6b1662d9cd312ae7319c /wsme/tests/test_restjson.py | |
parent | 52f756a9deb925744e6c3ec293ac6d3e94600eb1 (diff) | |
parent | 078cd723655b4cf52835a66f19bd9a2b85d0b73a (diff) | |
download | wsme-7784cc73b1905f8038249b071d3c766ef6180b1f.tar.gz |
Merge "rest: return 415 when content-type is invalid"
Diffstat (limited to 'wsme/tests/test_restjson.py')
-rw-r--r-- | wsme/tests/test_restjson.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/wsme/tests/test_restjson.py b/wsme/tests/test_restjson.py index 4ed6423..3368703 100644 --- a/wsme/tests/test_restjson.py +++ b/wsme/tests/test_restjson.py @@ -254,6 +254,15 @@ class TestRestJson(wsme.tests.protocol.RestOnlyProtocolTestCase): print(r) assert json.loads(r.text) == 2 + def test_invalid_content_type_body(self): + r = self.app.post('/argtypes/setint.json', '{"value": 2}', + headers={"Content-Type": "application/invalid"}, + expect_errors=True) + print(r) + assert r.status_int == 415 + assert json.loads(r.text)['faultstring'] == \ + "Unknown mimetype: application/invalid" + def test_invalid_json_body(self): r = self.app.post('/argtypes/setint.json', '{"value": 2', headers={"Content-Type": "application/json"}, |