def test_defaults(): request = Request('Create', 'abc') r = SecretProvider() r.set_request(request, {}) assert r.is_valid_request() assert r.get('Length') == 30 assert r.get('Alphabet') == r.request_schema['properties']['Alphabet']['default'] assert not r.get('ReturnSecret') assert r.get('KeyAlias') == 'alias/aws/ssm' assert r.get('Description') == ''
def test_type_convert(): request = Request('Create', 'abc') request['ResourceProperties']['Length'] = '62' request['ResourceProperties']['ReturnSecret'] = 'true' request['ResourceProperties']['RefreshOnUpdate'] = 'true' r = SecretProvider() r.set_request(request, {}) assert r.is_valid_request() assert r.get('Length') == 62 assert r.get('ReturnSecret') request['ResourceProperties']['Length'] = 'fouteboole62' r = SecretProvider() r.set_request(request, {}) assert not r.is_valid_request() request['ResourceProperties']['Length'] = u'62' request['ResourceProperties']['ReturnSecret'] = u'true' r.set_request(request, {}) assert r.is_valid_request() assert r.get('Length') == 62 assert r.get('ReturnSecret')
def test_type_convert(): request = Request("Create", "abc") request["ResourceProperties"]["Length"] = "62" request["ResourceProperties"]["ReturnSecret"] = "true" request["ResourceProperties"]["RefreshOnUpdate"] = "true" r = SecretProvider() r.set_request(request, {}) assert r.is_valid_request() assert r.get("Length") == 62 assert r.get("ReturnSecret") request["ResourceProperties"]["Length"] = "fouteboole62" r = SecretProvider() r.set_request(request, {}) assert not r.is_valid_request() request["ResourceProperties"]["Length"] = u"62" request["ResourceProperties"]["ReturnSecret"] = u"true" r.set_request(request, {}) assert r.is_valid_request() assert r.get("Length") == 62 assert r.get("ReturnSecret")
def test_defaults(): request = Request("Create", "abc") r = SecretProvider() r.set_request(request, {}) assert r.is_valid_request() assert r.get("Length") == 30 assert r.get( "Alphabet") == r.request_schema["properties"]["Alphabet"]["default"] assert not r.get("ReturnSecret") assert r.get("KeyAlias") == "alias/aws/ssm" assert r.get("Description") == "" assert isinstance(r.get("NoEcho"), bool) and r.get("NoEcho")