MCPcopy Index your code
hub / github.com/docker/docker-py / test_load_config_identity_token

Method test_load_config_identity_token

tests/unit/auth_test.py:431–453  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

429 assert dict(cfg) == {'auths': {'scarlet.net': {}}}
430
431 def test_load_config_identity_token(self):
432 folder = tempfile.mkdtemp()
433 registry = 'scarlet.net'
434 token = '1ce1cebb-503e-7043-11aa-7feb8bd4a1ce'
435 self.addCleanup(shutil.rmtree, folder)
436 dockercfg_path = os.path.join(folder, 'config.json')
437 auth_entry = encode_auth({'username': 'sakuya'}).decode('ascii')
438 config = {
439 'auths': {
440 registry: {
441 'auth': auth_entry,
442 'identitytoken': token
443 }
444 }
445 }
446 with open(dockercfg_path, 'w') as f:
447 json.dump(config, f)
448
449 cfg = auth.load_config(dockercfg_path)
450 assert registry in cfg.auths
451 cfg = cfg.auths[registry]
452 assert 'IdentityToken' in cfg
453 assert cfg['IdentityToken'] == token
454
455
456class CredstoreTest(unittest.TestCase):

Callers

nothing calls this directly

Calls 3

encode_authFunction · 0.85
joinMethod · 0.80
load_configMethod · 0.80

Tested by

no test coverage detected