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

Use consistent variable naming in upload coverage API requests #991

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions upload/tests/views/test_upload_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def test_deactivated_repo(db):
)
client = APIClient()
client.credentials(HTTP_AUTHORIZATION="token " + repository.upload_token)
response = client.post(url, {"commit_sha": "abc123"}, format="json")
response = client.post(url, {"commitid": "abc123"}, format="json")
assert response.status_code == 400
assert "This repository is deactivated" in str(response.json())

Expand All @@ -91,7 +91,7 @@ def test_upload_coverage_with_errors(db):

# Invalid flag format
response = client.post(
url, {"commit_sha": "abc123", "flags": "not-a-list"}, format="json"
url, {"commitid": "abc123", "flags": "not-a-list"}, format="json"
)
assert response.status_code == 400
assert "flags" in response.json()
Expand Down Expand Up @@ -131,7 +131,7 @@ def test_upload_coverage_post(db, mocker):
"ci_service": "ci_service",
"ci_url": "ci_url",
"code": "code",
"commit_sha": commit.commitid,
"commitid": commit.commitid,
"flags": ["flag1", "flag2"],
"job_code": "job_code",
"version": "version",
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_upload_coverage_post_shelter(db, mocker):
"ci_service": "ci_service",
"ci_url": "ci_url",
"code": "code",
"commit_sha": commit.commitid,
"commitid": commit.commitid,
"flags": ["flag1", "flag2"],
"job_code": "job_code",
"storage_path": "shelter/test/path.txt",
Expand Down
12 changes: 6 additions & 6 deletions upload/views/upload_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ def post(self, request: HttpRequest, *args, **kwargs) -> Response:

# Create commit
create_commit_data = dict(
commitid=request.data.get("commit_sha"),
parent_commit_id=request.data.get("parent_sha"),
pullid=request.data.get("pull_request_number"),
branch=request.data.get("branch"),
commitid=request.data.get("commitid"),
parent_commit_id=request.data.get("parent_commit_id"),
pullid=request.data.get("pullid"),
)
commit_serializer = CommitSerializer(data=create_commit_data)
if not commit_serializer.is_valid():
Expand Down Expand Up @@ -107,10 +107,10 @@ def post(self, request: HttpRequest, *args, **kwargs) -> Response:

# Do upload
upload_data = dict(
ci_url=request.data.get("build_url"),
env=request.data.get("env_vars"),
flags=request.data.get("flags"),
ci_service=request.data.get("ci_service"),
ci_url=request.data.get("ci_url"),
env=request.data.get("env"),
flags=request.data.get("flags"),
job_code=request.data.get("job_code"),
name=request.data.get("name"),
version=request.data.get("version"),
Expand Down
Loading