Skip to content

Commit

Permalink
2119 fix unknown error (#1061)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-codecov authored Dec 16, 2024
1 parent 622b048 commit e3b3e49
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 11 deletions.
36 changes: 27 additions & 9 deletions upload/tests/views/test_uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ def test_uploads_post(db, mocker, mock_redis):
)
response_json = response.json()
upload = ReportSession.objects.filter(
report_id=commit_report.id, upload_extras={"format_version": "v1"}
report_id=commit_report.id,
upload_extras={"format_version": "v1"},
state="started",
).first()
assert response.status_code == 201
assert all(
Expand All @@ -252,7 +254,9 @@ def test_uploads_post(db, mocker, mock_redis):
)

assert ReportSession.objects.filter(
report_id=commit_report.id, upload_extras={"format_version": "v1"}
report_id=commit_report.id,
upload_extras={"format_version": "v1"},
state="started",
).exists()
assert RepositoryFlag.objects.filter(
repository_id=repository.repoid, flag_name="flag1"
Expand Down Expand Up @@ -348,7 +352,9 @@ def test_uploads_post_tokenless(db, mocker, mock_redis, private, branch, branch_
assert response.status_code == 201
response_json = response.json()
upload = ReportSession.objects.filter(
report_id=commit_report.id, upload_extras={"format_version": "v1"}
report_id=commit_report.id,
upload_extras={"format_version": "v1"},
state="started",
).first()
assert all(
map(
Expand All @@ -362,7 +368,9 @@ def test_uploads_post_tokenless(db, mocker, mock_redis, private, branch, branch_
)

assert ReportSession.objects.filter(
report_id=commit_report.id, upload_extras={"format_version": "v1"}
report_id=commit_report.id,
upload_extras={"format_version": "v1"},
state="started",
).exists()
assert RepositoryFlag.objects.filter(
repository_id=repository.repoid, flag_name="flag1"
Expand Down Expand Up @@ -496,7 +504,9 @@ def test_uploads_post_token_required_auth_check(
assert response.status_code == 201
response_json = response.json()
upload = ReportSession.objects.filter(
report_id=commit_report.id, upload_extras={"format_version": "v1"}
report_id=commit_report.id,
upload_extras={"format_version": "v1"},
state="started",
).first()
assert all(
map(
Expand All @@ -510,7 +520,9 @@ def test_uploads_post_token_required_auth_check(
)

assert ReportSession.objects.filter(
report_id=commit_report.id, upload_extras={"format_version": "v1"}
report_id=commit_report.id,
upload_extras={"format_version": "v1"},
state="started",
).exists()
assert RepositoryFlag.objects.filter(
repository_id=repository.repoid, flag_name="flag1"
Expand Down Expand Up @@ -626,7 +638,9 @@ def test_uploads_post_github_oidc_auth(
assert response.status_code == 201
response_json = response.json()
upload = ReportSession.objects.filter(
report_id=commit_report.id, upload_extras={"format_version": "v1"}
report_id=commit_report.id,
upload_extras={"format_version": "v1"},
state="started",
).first()
assert all(
map(
Expand All @@ -640,7 +654,9 @@ def test_uploads_post_github_oidc_auth(
)

assert ReportSession.objects.filter(
report_id=commit_report.id, upload_extras={"format_version": "v1"}
report_id=commit_report.id,
upload_extras={"format_version": "v1"},
state="started",
).exists()
assert RepositoryFlag.objects.filter(
repository_id=repository.repoid, flag_name="flag1"
Expand Down Expand Up @@ -754,7 +770,9 @@ def test_uploads_post_shelter(db, mocker, mock_redis):
)

upload = ReportSession.objects.filter(
report_id=commit_report.id, upload_extras={"format_version": "v1"}
report_id=commit_report.id,
upload_extras={"format_version": "v1"},
state="started",
).first()
assert response.status_code == 201
ArchiveService(repository)
Expand Down
3 changes: 1 addition & 2 deletions upload/views/uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ def create_upload(
archive_service = ArchiveService(repository)
# Create upload record
instance: ReportSession = serializer.save(
report_id=report.id,
upload_extras={"format_version": "v1"},
report_id=report.id, upload_extras={"format_version": "v1"}, state="started"
)

# Inserts mirror upload record into measurements table. CLI hits this endpoint
Expand Down

0 comments on commit e3b3e49

Please sign in to comment.