From 06709099debd41ef9c75a4c6f24c3eb1c14eb8a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Douglas=20Mendiz=C3=A1bal?= Date: Thu, 26 Mar 2015 16:43:36 -0500 Subject: [PATCH] Don't ignore payload_content_encoding if set Even though setting the payload_content_encoding is deprecated, we should not ignore it if set. Uncommented functional tests that found this bug. Removed a couple of tests because they were incorrect. Change-Id: Idd294909ddd622d3baf2e8df92c94f8f52ac5799 Closes-Bug: #1434652 --- barbicanclient/secrets.py | 2 +- .../client/v1/functional/test_secrets.py | 23 ++++++------------- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/barbicanclient/secrets.py b/barbicanclient/secrets.py index 0341947b..9db80233 100644 --- a/barbicanclient/secrets.py +++ b/barbicanclient/secrets.py @@ -267,7 +267,7 @@ class Secret(SecretFormatter): raise exceptions.PayloadException("Missing Payload") if not isinstance(self.payload, (six.text_type, six.binary_type)): raise exceptions.PayloadException("Invalid Payload Type") - if self.payload_content_type: + if self.payload_content_type or self.payload_content_encoding: """ Setting the payload_content_type and payload_content_encoding manually is deprecated. This clause of the if statement is here diff --git a/functionaltests/client/v1/functional/test_secrets.py b/functionaltests/client/v1/functional/test_secrets.py index a6df1bb0..fa9218fb 100644 --- a/functionaltests/client/v1/functional/test_secrets.py +++ b/functionaltests/client/v1/functional/test_secrets.py @@ -473,22 +473,13 @@ class SecretsTestCase(base.TestCase): 'payload_content_type': 'text/plain', 'payload_content_encoding': 'invalid'}, - #Launchpad Bug (1434652) - # 'none_content_type_invalid_content_encoding': { - # 'payload_content_type': None, - # 'payload_content_encoding': 'invalid'}, - # - # 'empty_content_type_and_encoding': { - # 'payload_content_type': '', - # 'payload_content_encoding': ''}, - # - # 'none_content_type_and_encoding': { - # 'payload_content_type': None, - # 'payload_content_encoding': None}, - # - # 'none_content_type_base64_content_encoding': { - # 'payload_content_type': None, - # 'payload_content_encoding': 'base64'} + 'none_content_type_invalid_content_encoding': { + 'payload_content_type': None, + 'payload_content_encoding': 'invalid'}, + + 'none_content_type_base64_content_encoding': { + 'payload_content_type': None, + 'payload_content_encoding': 'base64'} }) @testcase.attr('negative') def test_secret_create_defaults_invalid_types_and_encoding(self, **kwargs):