Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion docker/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,12 @@ def resolve_authconfig(authconfig, registry=None):
log.debug(
'Using credentials store "{0}"'.format(store_name)
)
return _resolve_authconfig_credstore(
cfg = _resolve_authconfig_credstore(
authconfig, registry, store_name
)
if cfg is not None:
return cfg
log.debug('No entry in credstore - fetching from auth dict')

# Default to the public index server
registry = resolve_index_name(registry) if registry else INDEX_NAME
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/auth_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,19 @@ def test_resolve_registry_and_auth_unauthenticated_registry(self):
self.auth_config, auth.resolve_repository_name(image)[0]
) is None

def test_resolve_auth_with_empty_credstore_and_auth_dict(self):
auth_config = {
'auths': auth.parse_auth({
'https://index.docker.io/v1/': self.index_config,
}),
'credsStore': 'blackbox'
}
with mock.patch('docker.auth._resolve_authconfig_credstore') as m:
m.return_value = None
assert 'indexuser' == auth.resolve_authconfig(
auth_config, None
)['username']


class CredStoreTest(unittest.TestCase):
def test_get_credential_store(self):
Expand Down