(self)
| 266 | assert cfg.get('Auth') is None |
| 267 | |
| 268 | def test_load_modern_json_config(self): |
| 269 | folder = tempfile.mkdtemp() |
| 270 | self.addCleanup(shutil.rmtree, folder) |
| 271 | cfg_path = os.path.join(folder, 'config.json') |
| 272 | auth_ = base64.b64encode(b'sakuya:izayoi').decode('ascii') |
| 273 | email = 'sakuya@scarlet.net' |
| 274 | with open(cfg_path, 'w') as f: |
| 275 | json.dump({ |
| 276 | 'auths': { |
| 277 | auth.INDEX_URL: { |
| 278 | 'auth': auth_, 'email': email |
| 279 | } |
| 280 | } |
| 281 | }, f) |
| 282 | cfg = auth.load_config(cfg_path) |
| 283 | assert auth.resolve_authconfig(cfg) is not None |
| 284 | assert cfg.auths[auth.INDEX_URL] is not None |
| 285 | cfg = cfg.auths[auth.INDEX_URL] |
| 286 | assert cfg['username'] == 'sakuya' |
| 287 | assert cfg['password'] == 'izayoi' |
| 288 | assert cfg['email'] == email |
| 289 | |
| 290 | def test_load_config_with_random_name(self): |
| 291 | folder = tempfile.mkdtemp() |
nothing calls this directly
no test coverage detected