Skip to content

Commit

Permalink
Issue #45: Get the real package name from Pypi before request it (fix…
Browse files Browse the repository at this point in the history
…ed tests).
  • Loading branch information
Nekmo committed Sep 30, 2023
1 parent 9c8f6b3 commit 741ac67
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/sources/test_sourcerank.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def test_request(self, mock_requests: MagicMock, mock_time: MagicMock):
sourcerank = SourceRank(mock_package)
self.assertEqual(SOURCERANK_PAGE, sourcerank.request())
mock_requests.get.assert_called_once_with(
f"https://libraries.io/pypi/{mock_package.name}/sourcerank"
f"https://libraries.io/pypi/{mock_package.real_name}/sourcerank"
)
mock_requests.reset_mock()
with self.subTest("Test successful request with 429 error"):
Expand All @@ -188,7 +188,11 @@ def test_request(self, mock_requests: MagicMock, mock_time: MagicMock):
sourcerank = SourceRank(mock_package)
self.assertEqual(SOURCERANK_PAGE, sourcerank.request())
mock_requests.get.assert_has_calls(
[mock.call(f"https://libraries.io/pypi/{mock_package.name}/sourcerank")]
[
mock.call(
f"https://libraries.io/pypi/{mock_package.real_name}/sourcerank"
)
]
* 2,
any_order=True,
)
Expand Down

0 comments on commit 741ac67

Please sign in to comment.