Skip to content

Commit

Permalink
fix: Don't clear image tag
Browse files Browse the repository at this point in the history
Just because you've augmented an image with a new property (digest) doesn't mean you get to clear a different value (tag) in the setter.

Signed-off-by: Philipp Belitz <[email protected]>
  • Loading branch information
richgerrard authored and phbelitz committed Nov 25, 2022
1 parent ad0ce79 commit ba35976
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
1 change: 0 additions & 1 deletion connaisseur/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ def set_digest(self, digest):
Set the digest to the given `digest`.
"""
self.digest = digest
self.tag = None

def has_digest(self) -> bool:
"""
Expand Down
13 changes: 10 additions & 3 deletions tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,20 @@ def test_image(


@pytest.mark.parametrize(
"image, digest",
[("image:tag", "859b5aada817b3eb53410222e8fc232cf126c9e598390ae61895eb96f52ae46d")],
"image, tag, digest",
[
(
"image:tag",
"tag",
"859b5aada817b3eb53410222e8fc232cf126c9e598390ae61895eb96f52ae46d",
)
],
)
def test_set_digest(image: str, digest: str):
def test_set_digest(image: str, tag: str, digest: str):
i = img.Image(image)
i.set_digest(digest)
assert i.digest == digest
assert i.tag == tag


@pytest.mark.parametrize(
Expand Down

0 comments on commit ba35976

Please sign in to comment.