Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extract report logic #323

Open
wants to merge 18 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test for package not found
  • Loading branch information
Robin5605 committed Oct 6, 2024
commit fa7a8604bb5020fc9b0afafb31bbf71597b34ab9
12 changes: 12 additions & 0 deletions tests/test_report.py
Original file line number Diff line number Diff line change
@@ -128,7 +128,19 @@ def test_report_package_not_on_pypi():

assert e.value.status_code == 404

def test_report_package_not_found(auth: AuthenticationData, mock_database: MockDatabase):
body = ReportPackageBody(
name="this-package-does-not-exist",
version="1.0.0",
recipient=None,
inspector_url=None,
additional_information="this package is bad",
)

with pytest.raises(HTTPException) as e:
report_package(body, mock_database, auth, MagicMock())

assert e.value.status_code == 404
def test_report(auth: AuthenticationData, mock_database: MockDatabase):
scan = Scan(
name="c",