Skip to content

Commit

Permalink
test hash shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
wimglenn committed Oct 24, 2024
1 parent ea3108b commit cec07a2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions tests/test_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from textwrap import dedent

import pytest
from packaging.requirements import Requirement

from johnnydep import lib
from johnnydep.lib import flatten_deps
Expand Down Expand Up @@ -525,3 +526,12 @@ def test_ignore_errors_version_attrs(mocker):
mocker.patch("unearth.finder.PackageFinder.find_matches", return_value=[])
dist = JohnnyDist("notexist", ignore_errors=True)
assert dist.version_latest is None


def test_checksum_from_link(make_dist, mocker):
make_dist()
dist = JohnnyDist("jdtest")
get_link = mocker.patch("johnnydep.lib._get_link")
get_link.return_value.link.hashes = {"sha256": "cafef00d"}
assert dist.checksum == "sha256=cafef00d"
get_link.assert_called_once_with(Requirement("jdtest"))

0 comments on commit cec07a2

Please sign in to comment.