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

Method test_load_modern_json_config

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

Source from the content-addressed store, hash-verified

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()

Callers

nothing calls this directly

Calls 3

joinMethod · 0.80
load_configMethod · 0.80
resolve_authconfigMethod · 0.80

Tested by

no test coverage detected