def test_basic_auth(self): url = mock_v2_registry() AuthorizationService.DEFAULT_CONFIG_PATH = None c = BaseClientV2(url, username='******', password='******') c.check_status() assert c.auth.auth is not None assert c.auth.auth == ('toto', 'tete')
def test_get_config(self): url = mock_v2_registry() t = tempfile.NamedTemporaryFile(delete=False) t.write(json.dumps({ "auths": { url: { "auth": "ocucouhibou==" }, "https://index.docker.io/v1/": { "auth": "lolilol==", "email": "*****@*****.**" }, }}).encode('utf-8')) t.close() AuthorizationService.DEFAULT_CONFIG_PATH = t.name c = BaseClientV2(url) c.check_status() assert c.auth.auth is not None assert c.auth.auth.token_from_config == "ocucouhibou==" os.unlink(t.name)
def test_initv2(self): url = mock_v2_registry() Repository(BaseClientV2(url), TEST_NAME)
def test_get_manifest_and_digest(self): url = mock_v2_registry() manifest, digest = BaseClientV2(url).get_manifest_and_digest(TEST_NAME, TEST_TAG)
def test_check_status(self): url = mock_v2_registry() BaseClientV2(url).check_status()
def test_repository_manifest(self): url = mock_v2_registry() client = DockerRegistryClient(url) repository = client.repositories()[TEST_NAME] manifest, digest = repository.manifest(TEST_TAG) repository.delete_manifest(digest)
def test_initv2(self): url = mock_v2_registry() Repository(BaseClientV2(url), TEST_NAME)