Skip to content

Commit

Permalink
Retrun list in get_package_versions
Browse files Browse the repository at this point in the history
Signed-off-by: Keshav Priyadarshi <[email protected]>
  • Loading branch information
keshav-space committed Dec 20, 2023
1 parent 85f7873 commit 2146ec4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions vulnerabilities/improvers/valid_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ def get_package_versions(
Return a list of versions published before `until` for the `package_url`
"""
versions = package_versions.versions(str(package_url))
versions_before_until = set()
versions_before_until = []
for version in versions or []:
if until and version.release_date and version.release_date > until:
continue
versions_before_until.add(version.value)
versions_before_until.append(version.value)

return versions_before_until

Expand Down
9 changes: 5 additions & 4 deletions vulnerabilities/tests/test_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def test_get_package_versions(mock_response):
mock_response.return_value = json.load(f)

improver = GitHubBasicImprover()
valid_versions = {
valid_versions = [
"1.1.3",
"1.1.4",
"1.10",
Expand All @@ -300,11 +300,12 @@ def test_get_package_versions(mock_response):
"1.10a1",
"1.10b1",
"1.10rc1",
}
assert (
]
result = sorted(
improver.get_package_versions(package_url=PackageURL(type="pypi", name="django"))
== valid_versions
)
expected = sorted(valid_versions)
assert result == expected


def test_get_cwes_from_github_advisory():
Expand Down

0 comments on commit 2146ec4

Please sign in to comment.