Kaydet (Commit) 539b321b authored tarafından Joffrey F's avatar Joffrey F

Add login data to the right subdict in auth_configs

Signed-off-by: 's avatarJoffrey F <joffrey@docker.com>
üst a60011ca
...@@ -139,7 +139,7 @@ class DaemonApiMixin(object): ...@@ -139,7 +139,7 @@ class DaemonApiMixin(object):
if response.status_code == 200: if response.status_code == 200:
if 'auths' not in self._auth_configs: if 'auths' not in self._auth_configs:
self._auth_configs['auths'] = {} self._auth_configs['auths'] = {}
self._auth_configs[registry or auth.INDEX_NAME] = req_data self._auth_configs['auths'][registry or auth.INDEX_NAME] = req_data
return self._result(response, json=True) return self._result(response, json=True)
def ping(self): def ping(self):
......
...@@ -212,6 +212,24 @@ class DockerApiTest(BaseAPIClientTest): ...@@ -212,6 +212,24 @@ class DockerApiTest(BaseAPIClientTest):
timeout=DEFAULT_TIMEOUT_SECONDS timeout=DEFAULT_TIMEOUT_SECONDS
) )
def test_login(self):
self.client.login('sakuya', 'izayoi')
fake_request.assert_called_with(
'POST', url_prefix + 'auth',
data=json.dumps({'username': 'sakuya', 'password': 'izayoi'}),
timeout=DEFAULT_TIMEOUT_SECONDS,
headers={'Content-Type': 'application/json'}
)
assert self.client._auth_configs['auths'] == {
'docker.io': {
'email': None,
'password': 'izayoi',
'username': 'sakuya',
'serveraddress': None,
}
}
def test_events(self): def test_events(self):
self.client.events() self.client.events()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment