Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: make push response the one pertaining to Manifest (not config #146

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion oras/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,7 +805,10 @@ def push(

# Final upload of the manifest
manifest["config"] = conf
self._check_200_response(self.upload_manifest(manifest, container))
response = self.upload_manifest(
manifest, container
) # make the returned response from this method, the one pertaining to the uploaded Manifest
self._check_200_response(response)
print(f"Successfully pushed {container}")
return response

Expand Down
22 changes: 22 additions & 0 deletions oras/tests/test_oras.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,28 @@ def test_basic_push_pull(tmp_path, registry, credentials, target):
assert res.status_code == 201


@pytest.mark.with_auth(False)
def test_basic_push_pul_via_sha_ref(tmp_path, registry, credentials, target):
"""
Basic tests for oras pushing and then pulling with SHA reference
"""
client = oras.client.OrasClient(hostname=registry, insecure=True)
artifact = os.path.join(here, "artifact.txt")

assert os.path.exists(artifact)

res = client.push(files=[artifact], target=target)
assert res.status_code in [200, 201]

# Test pulling elsewhere
using_ref = f"{registry}/dinosaur/artifact@{res.headers['Docker-Content-Digest']}"
files = client.pull(target=using_ref, outdir=tmp_path)
assert len(files) == 1
assert os.path.basename(files[0]) == "artifact.txt"
assert str(tmp_path) in files[0]
assert os.path.exists(files[0])


@pytest.mark.with_auth(False)
def test_get_delete_tags(tmp_path, registry, credentials, target):
"""
Expand Down
Loading