Fix functional base request functions

A recent update to pecan made it so that controllers that don't
explicitly return anything now come with a '204 No Content' status.
This breaks one of our functional tests as we try to return the json
content of a response with no content.

This patch makes it so the json content of a response is returned only
if the content_type is 'application/json'.

Change-Id: Icf812eb4feddc88011d215c006ec58a14dae7506
This commit is contained in:
Paul Van Eck 2016-09-23 13:51:08 -07:00
parent 3c4d6bd5d9
commit 5a3984f7e2

View File

@ -167,7 +167,7 @@ class FunctionalTest(base.BaseTestCase):
expect_errors=expect_errors, expect_errors=expect_errors,
params=params) params=params)
if not expect_errors: if not expect_errors and response.content_type == 'application/json':
response = response.json response = response.json
return response return response
@ -200,7 +200,7 @@ class FunctionalTest(base.BaseTestCase):
content_type=content_type, content_type=content_type,
**params) **params)
if not expect_errors: if not expect_errors and response.content_type == 'application/json':
response = response.json response = response.json
return response return response
@ -216,6 +216,6 @@ class FunctionalTest(base.BaseTestCase):
content_type=content_type, content_type=content_type,
**params) **params)
if not expect_errors: if not expect_errors and response.content_type == 'application/json':
response = response.json response = response.json
return response return response