(self)
| 247 | assert cfg.get('Auth') is None |
| 248 | |
| 249 | def test_load_json_config(self): |
| 250 | folder = tempfile.mkdtemp() |
| 251 | self.addCleanup(shutil.rmtree, folder) |
| 252 | cfg_path = os.path.join(folder, '.dockercfg') |
| 253 | auth_ = base64.b64encode(b'sakuya:izayoi').decode('ascii') |
| 254 | email = 'sakuya@scarlet.net' |
| 255 | with open(cfg_path, 'w') as f: |
| 256 | json.dump( |
| 257 | {auth.INDEX_URL: {'auth': auth_, 'email': email}}, f |
| 258 | ) |
| 259 | cfg = auth.load_config(cfg_path) |
| 260 | assert auth.resolve_authconfig(cfg) is not None |
| 261 | assert cfg.auths[auth.INDEX_URL] is not None |
| 262 | cfg = cfg.auths[auth.INDEX_URL] |
| 263 | assert cfg['username'] == 'sakuya' |
| 264 | assert cfg['password'] == 'izayoi' |
| 265 | assert cfg['email'] == email |
| 266 | assert cfg.get('Auth') is None |
| 267 | |
| 268 | def test_load_modern_json_config(self): |
| 269 | folder = tempfile.mkdtemp() |
nothing calls this directly
no test coverage detected