Allow null values for secret names
This secret allows null values for names in secrets as discussed a couple of cycles back. Since the code for the mocked client in the functional tests actually filters out null values, it is currently not possible to write a functional test for this in this functional test code base. However, it will be written as part of the python-barbicanclient functional test suite. Change-Id: I68330d1d1b13e1bbb6436ca4f6684a76af3babd3 Related-bug: #1425667 Related-bug: #1376469
This commit is contained in:
parent
a78328e7d5
commit
c098455d2e
|
@ -180,7 +180,7 @@ class NewSecretValidator(ValidatorBase):
|
|||
self.schema = {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {"type": "string", "maxLength": 255},
|
||||
"name": {"type": ["string", "null"], "maxLength": 255},
|
||||
"algorithm": {"type": "string", "maxLength": 255},
|
||||
"mode": {"type": "string", "maxLength": 255},
|
||||
"bit_length": {
|
||||
|
@ -242,6 +242,7 @@ class NewSecretValidator(ValidatorBase):
|
|||
payload, schema_name)
|
||||
json_data['payload'] = payload
|
||||
elif 'payload_content_type' in json_data:
|
||||
# parent_schema would be populated if it comes from an order.
|
||||
self._assert_validity(parent_schema is not None, schema_name,
|
||||
u._("payload must be provided when "
|
||||
"payload_content_type is specified"),
|
||||
|
|
|
@ -146,6 +146,10 @@ class WhenTestingSecretValidator(utils.BaseTestCase):
|
|||
self.secret_req['name'] = ' '
|
||||
self.validator.validate(self.secret_req)
|
||||
|
||||
def test_should_validate_null_name(self):
|
||||
self.secret_req['name'] = None
|
||||
self.validator.validate(self.secret_req)
|
||||
|
||||
def test_should_validate_no_payload(self):
|
||||
del self.secret_req['payload']
|
||||
del self.secret_req['payload_content_type']
|
||||
|
|
Loading…
Reference in New Issue