Add functional test for updating a Secret

Adds a functional test for updating a secret using the Barbican
Client.

Change-Id: Iff546f522e27ec7d5f3bc0046f80e0b019e40d6d
This commit is contained in:
Fernando Diaz
2015-09-02 10:19:14 -05:00
parent 8c2050f018
commit d60c7a4e1d

View File

@@ -649,6 +649,35 @@ class SecretsTestCase(base.TestCase):
self.assertEqual(e.status_code, 400)
@utils.parameterized_dataset({
'text/plain':
[
u'meowwwwwwwmeowwwwwww',
'text/plain'],
'application/octet-stream':
[
base64.b64encode(
b'F\x130\x89f\x8e\xd9\xa1\x0e\x1f\r\xf67uu\x8b'),
'application/octet-stream'
]
})
@testcase.attr('positive')
def test_secret_update_nones(self, payload, payload_content_type):
"""Cover case of updating with all nones in the Secret object."""
secret = self.barbicanclient.secrets.create(**secret_create_nones_data)
secret.payload = None
secret.payload_content_type = None
secret_ref = self.cleanup.add_entity(secret)
self.assertIsNotNone(secret_ref)
secret.payload = payload
secret.update()
resp = self.barbicanclient.secrets.get(secret_ref)
self.assertEqual(resp.payload, payload)
self.assertEqual(resp.payload_content_type, payload_content_type)
@utils.parameterized_dataset({
'alphanumeric': ['1f34ds'],
'punctuation': ['~!@#$%^&*()_+`-={}[]|:;<>,.?'],