Skip to content

Commit

Permalink
core: make push response the one pertaining to Manifest (not config)
Browse files Browse the repository at this point in the history
Reproducer test (step 1/2)

Signed-off-by: tarilabs <matteo.mortari@gmail.com>
  • Loading branch information
tarilabs committed Jun 25, 2024
1 parent fd8a83c commit 9702a84
Showing 1 changed file with 22 additions and 0 deletions.
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

0 comments on commit 9702a84

Please sign in to comment.