From 5a3984f7e2e530b33926f9542cb26d57d778cdb5 Mon Sep 17 00:00:00 2001 From: Paul Van Eck Date: Fri, 23 Sep 2016 13:51:08 -0700 Subject: [PATCH] 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 --- refstack/tests/api/__init__.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/refstack/tests/api/__init__.py b/refstack/tests/api/__init__.py index 481f3d53..c57e6c08 100644 --- a/refstack/tests/api/__init__.py +++ b/refstack/tests/api/__init__.py @@ -167,7 +167,7 @@ class FunctionalTest(base.BaseTestCase): expect_errors=expect_errors, params=params) - if not expect_errors: + if not expect_errors and response.content_type == 'application/json': response = response.json return response @@ -200,7 +200,7 @@ class FunctionalTest(base.BaseTestCase): content_type=content_type, **params) - if not expect_errors: + if not expect_errors and response.content_type == 'application/json': response = response.json return response @@ -216,6 +216,6 @@ class FunctionalTest(base.BaseTestCase): content_type=content_type, **params) - if not expect_errors: + if not expect_errors and response.content_type == 'application/json': response = response.json return response