MCPcopy
hub / github.com/docker/docker-py / test_load_json_config

Method test_load_json_config

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

joinMethod · 0.80
load_configMethod · 0.80
resolve_authconfigMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected