Boto actually returns a base64 encoded string of <user>:<password>
Fix the mock to do the same thing
This commit is contained in:
parent
025e975e44
commit
aeefc8056d
@ -1,5 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
import json
|
||||
from base64 import b64encode
|
||||
from datetime import datetime
|
||||
import time
|
||||
|
||||
@ -117,8 +118,10 @@ class ECRResponse(BaseResponse):
|
||||
registry_ids = [self.region]
|
||||
auth_data = []
|
||||
for registry_id in registry_ids:
|
||||
password = '{}-auth-token'.format(registry_id)
|
||||
auth_token = b64encode("AWS:{}".format(password).encode('ascii')).decode()
|
||||
auth_data.append({
|
||||
'authorizationToken': '{}-auth-token'.format(registry_id),
|
||||
'authorizationToken': auth_token,
|
||||
'expiresAt': time.mktime(datetime(2015, 1, 1).timetuple()),
|
||||
'proxyEndpoint': 'https://012345678910.dkr.ecr.{}.amazonaws.com'.format(registry_id)
|
||||
})
|
||||
|
@ -380,7 +380,7 @@ def test_get_authorization_token_assume_region():
|
||||
list(auth_token_response.keys()).should.equal(['authorizationData', 'ResponseMetadata'])
|
||||
auth_token_response['authorizationData'].should.equal([
|
||||
{
|
||||
'authorizationToken': 'us-east-1-auth-token',
|
||||
'authorizationToken': 'QVdTOnVzLWVhc3QtMS1hdXRoLXRva2Vu',
|
||||
'proxyEndpoint': 'https://012345678910.dkr.ecr.us-east-1.amazonaws.com',
|
||||
'expiresAt': datetime(2015, 1, 1, tzinfo=tzlocal())
|
||||
},
|
||||
@ -395,12 +395,12 @@ def test_get_authorization_token_explicit_regions():
|
||||
list(auth_token_response.keys()).should.equal(['authorizationData', 'ResponseMetadata'])
|
||||
auth_token_response['authorizationData'].should.equal([
|
||||
{
|
||||
'authorizationToken': 'us-east-1-auth-token',
|
||||
'authorizationToken': 'QVdTOnVzLWVhc3QtMS1hdXRoLXRva2Vu',
|
||||
'proxyEndpoint': 'https://012345678910.dkr.ecr.us-east-1.amazonaws.com',
|
||||
'expiresAt': datetime(2015, 1, 1, tzinfo=tzlocal()),
|
||||
},
|
||||
{
|
||||
'authorizationToken': 'us-west-1-auth-token',
|
||||
'authorizationToken': 'QVdTOnVzLXdlc3QtMS1hdXRoLXRva2Vu',
|
||||
'proxyEndpoint': 'https://012345678910.dkr.ecr.us-west-1.amazonaws.com',
|
||||
'expiresAt': datetime(2015, 1, 1, tzinfo=tzlocal())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user