ERROR: barbican.tests.api.controllers.test_containers.WhenCreatingContainersUsingContainersResource.test_should_raise_container_no_content_type_header
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/pradeep/commit/barbican/barbican/tests/api/controllers/test_containers.py", line 115, in test_should_raise_container_no_content_type_header
headers={'Content-Type': ''}
File "/home/pradeep/commit/barbican/barbican/tests/api/controllers/test_containers.py", line 334, in create_container
headers=headers
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/webtest/utils.py", line 37, in wrapper
return self._gen_request(method, url, **kw)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/webtest/app.py", line 735, in _gen_request
expect_errors=expect_errors)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/webtest/app.py", line 605, in do_request
res = req.get_response(app, catch_exc_info=True)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/webob/request.py", line 1313, in send
application, catch_exc_info=True)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/webob/request.py", line 1281, in call_application
app_iter = application(self.environ, start_response)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/webtest/lint.py", line 198, in lint_app
iterator = application(environ, start_response_wrapper)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/pecan/core.py", line 829, in __call__
return super(Pecan, self).__call__(environ, start_response)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/pecan/core.py", line 677, in __call__
controller, args, kwargs = self.find_controller(state)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/pecan/core.py", line 847, in find_controller
controller, args, kw = super(Pecan, self).find_controller(_state)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/pecan/core.py", line 535, in find_controller
params = req.params
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/pecan/core.py", line 55, in __getattribute__
return WebObRequest.__getattribute__(self, name)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/webob/request.py", line 853, in params
params = NestedMultiDict(self.GET, self.POST)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/pecan/core.py", line 55, in __getattribute__
return WebObRequest.__getattribute__(self, name)
File "/home/pradeep/commit/barbican/.tox/py34/lib/python3.4/site-packages/webob/request.py", line 802, in POST
encoding='utf8')
File "/usr/lib/python3.4/cgi.py", line 561, in __init__
self.read_single()
File "/usr/lib/python3.4/cgi.py", line 724, in read_single
self.read_binary()
File "/usr/lib/python3.4/cgi.py", line 747, in read_binary
self.file.write(data)
TypeError: must be str, not bytes
May be its due to https://bugs.python.org/issue24764.
When i removed the content-type header exception is not thrown.
I don't think we need this bug. The failure is PY34 only, and can be fixed under the PY34 blueprint.
The issue is here: api/controllers /containers. py, line 171: s.enforce_ content_ types([ 'application/ json'])
In barbican/
@controller
This is a string passed in through the decorator which needs to be bytes later.