diff --git a/barbicanclient/exceptions.py b/barbicanclient/exceptions.py index e032de4f..e6cdbdc0 100644 --- a/barbicanclient/exceptions.py +++ b/barbicanclient/exceptions.py @@ -18,9 +18,5 @@ class BarbicanException(Exception): pass -class NoPayloadException(BarbicanException): - pass - - -class InvalidPayloadException(BarbicanException): +class PayloadException(BarbicanException): pass diff --git a/barbicanclient/secrets.py b/barbicanclient/secrets.py index 0bf44afa..0341947b 100644 --- a/barbicanclient/secrets.py +++ b/barbicanclient/secrets.py @@ -253,8 +253,7 @@ class Secret(SecretFormatter): Stores the Secret in Barbican. New Secret objects are not persisted in Barbican until this method is called. - :raises: NoPayloadException - :raises: InvalidPayloadException + :raises: PayloadException """ secret_dict = { 'name': self.name, @@ -265,9 +264,9 @@ class Secret(SecretFormatter): } if not self.payload: - raise exceptions.NoPayloadException + raise exceptions.PayloadException("Missing Payload") if not isinstance(self.payload, (six.text_type, six.binary_type)): - raise exceptions.InvalidPayloadException + raise exceptions.PayloadException("Invalid Payload Type") if self.payload_content_type: """ Setting the payload_content_type and payload_content_encoding diff --git a/functionaltests/client/v1/functional/test_secrets.py b/functionaltests/client/v1/functional/test_secrets.py index b1441327..a6df1bb0 100644 --- a/functionaltests/client/v1/functional/test_secrets.py +++ b/functionaltests/client/v1/functional/test_secrets.py @@ -153,7 +153,7 @@ class SecretsTestCase(base.TestCase): test_model.payload = None self.assertRaises( - exceptions.NoPayloadException, + exceptions.PayloadException, self.behaviors.store_secret, test_model ) @@ -168,7 +168,7 @@ class SecretsTestCase(base.TestCase): test_model.payload_content_type = None self.assertRaises( - exceptions.NoPayloadException, + exceptions.PayloadException, self.behaviors.store_secret, test_model ) @@ -211,7 +211,7 @@ class SecretsTestCase(base.TestCase): secret_create_emptystrings_data) self.assertRaises( - exceptions.NoPayloadException, + exceptions.PayloadException, self.behaviors.store_secret, test_model ) @@ -536,7 +536,7 @@ class SecretsTestCase(base.TestCase): test_model.payload = payload self.assertRaises( - exceptions.InvalidPayloadException, + exceptions.PayloadException, self.behaviors.store_secret, test_model ) @@ -557,7 +557,7 @@ class SecretsTestCase(base.TestCase): test_model.payload = payload self.assertRaises( - exceptions.NoPayloadException, + exceptions.PayloadException, self.behaviors.store_secret, test_model ) diff --git a/test-requirements.txt b/test-requirements.txt index 8cad4fb6..684cef9e 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -3,7 +3,7 @@ # process, which may cause wedges in the gate later. coverage>=3.6 discover -hacking>=0.7.0 +hacking>=0.10.0,<0.11 fixtures>=0.3.14 requests-mock>=0.6.0 # Apache-2.0 mock>=1.0