(self)
| 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 | |
| 456 | class CredstoreTest(unittest.TestCase): |
nothing calls this directly
no test coverage detected