APIGateway - Generate API key value when no value provided (#1713)
This commit is contained in:
parent
c3b690114c
commit
c20e8568e0
@ -300,11 +300,7 @@ class ApiKey(BaseModel, dict):
|
|||||||
generateDistinctId=False, value=None, stageKeys=None, customerId=None):
|
generateDistinctId=False, value=None, stageKeys=None, customerId=None):
|
||||||
super(ApiKey, self).__init__()
|
super(ApiKey, self).__init__()
|
||||||
self['id'] = create_id()
|
self['id'] = create_id()
|
||||||
if generateDistinctId:
|
self['value'] = value if value else ''.join(random.sample(string.ascii_letters + string.digits, 40))
|
||||||
# Best guess of what AWS does internally
|
|
||||||
self['value'] = ''.join(random.sample(string.ascii_letters + string.digits, 40))
|
|
||||||
else:
|
|
||||||
self['value'] = value
|
|
||||||
self['name'] = name
|
self['name'] = name
|
||||||
self['customerId'] = customerId
|
self['customerId'] = customerId
|
||||||
self['description'] = description
|
self['description'] = description
|
||||||
|
@ -981,7 +981,7 @@ def test_api_keys():
|
|||||||
apikey['value'].should.equal(apikey_value)
|
apikey['value'].should.equal(apikey_value)
|
||||||
|
|
||||||
apikey_name = 'TESTKEY2'
|
apikey_name = 'TESTKEY2'
|
||||||
payload = {'name': apikey_name, 'generateDistinctId': True}
|
payload = {'name': apikey_name }
|
||||||
response = client.create_api_key(**payload)
|
response = client.create_api_key(**payload)
|
||||||
apikey_id = response['id']
|
apikey_id = response['id']
|
||||||
apikey = client.get_api_key(apiKey=apikey_id)
|
apikey = client.get_api_key(apiKey=apikey_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user