mirror of https://github.com/docker/docker-py.git
Merge pull request #1896 from docker/1895-login-auths
Add login data to the right subdict in auth_configs
This commit is contained in:
commit
855b71eabe
|
@ -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):
|
||||||
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()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue