def test_find_config_from_home_windows(self): tmpdir = self.tmpdir('test_find_config_from_home_windows') config_path = tmpdir.ensure('.docker', 'config.json') with mock.patch.dict(os.environ, {'USERPROFILE': str(tmpdir)}): assert auth.find_config_file() == str(config_path)
def test_find_config_from_environment(self): tmpdir = self.tmpdir('test_find_config_from_environment') config_path = tmpdir.ensure('config.json') with mock.patch.dict(os.environ, {'DOCKER_CONFIG': str(tmpdir)}): assert auth.find_config_file() == str(config_path)
def test_find_config_from_home_legacy_name(self): tmpdir = self.tmpdir('test_find_config_from_home_legacy_name') config_path = tmpdir.ensure('.dockercfg') with mock.patch.dict(os.environ, {'HOME': str(tmpdir)}): assert auth.find_config_file() == str(config_path)
def test_find_config_fallback(self): tmpdir = self.tmpdir('test_find_config_fallback') with mock.patch.dict(os.environ, {'HOME': str(tmpdir)}): assert auth.find_config_file() is None
def test_find_config_from_explicit_path(self): tmpdir = self.tmpdir('test_find_config_from_explicit_path') config_path = tmpdir.ensure('my-config-file.json') assert auth.find_config_file(str(config_path)) == str(config_path)