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

Fix/api update pteam service method post to put #377

Merged
merged 2 commits into from
Oct 1, 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
2 changes: 1 addition & 1 deletion api/app/routers/pteams.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ def get_pteam_services(
return sorted(pteam.services, key=lambda x: x.service_name)


@router.post("/{pteam_id}/services/{service_id}", response_model=schemas.PTeamServiceUpdateResponse)
@router.put("/{pteam_id}/services/{service_id}", response_model=schemas.PTeamServiceUpdateResponse)
def update_pteam_service(
pteam_id: UUID,
service_id: UUID,
Expand Down
28 changes: 14 additions & 14 deletions api/app/tests/requests/test_pteams.py
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ def test_get_pteam_services_verify_if_all_responses_are_filled(service_request,

service_id1 = get_service_by_service_name(USER1, pteam1.pteam_id, service_name)["service_id"]

client.post(
client.put(
f"/pteams/{pteam1.pteam_id}/services/{service_id1}",
headers=headers(USER1),
json=service_request,
Expand Down Expand Up @@ -3528,7 +3528,7 @@ def test_number_of_keywords(self, keywords, expected):
}
request = {"keywords": keywords}

response = client.post(
response = client.put(
f"/pteams/{self.pteam1.pteam_id}/services/{self.service_id1}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -3577,7 +3577,7 @@ def test_length_of_keyword(self, keyword, expected):
}
request = {"keywords": [keyword]}

response = client.post(
response = client.put(
f"/pteams/{self.pteam1.pteam_id}/services/{self.service_id1}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -3627,7 +3627,7 @@ def test_length_of_description(self, description, expected):
}
request = {"description": description}

response = client.post(
response = client.put(
f"/pteams/{self.pteam1.pteam_id}/services/{self.service_id1}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -3665,7 +3665,7 @@ def test_it_should_return_200_when_system_exposure_is_SystemExposureEnum_or_None

request = {"system_exposure": system_exposure}

response = client.post(
response = client.put(
f"/pteams/{self.pteam1.pteam_id}/services/{self.service_id1}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -3695,7 +3695,7 @@ def test_it_should_return_422_when_system_exposure_is_not_SystemExposureEnum(

request = {"system_exposure": system_exposure}

response = client.post(
response = client.put(
f"/pteams/{self.pteam1.pteam_id}/services/{self.service_id1}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -3730,7 +3730,7 @@ def test_it_should_return_200_when_mission_impact_is_MissionImpactEnum_or_None(

request = {"service_mission_impact": service_mission_impact}

response = client.post(
response = client.put(
f"/pteams/{self.pteam1.pteam_id}/services/{self.service_id1}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -3768,7 +3768,7 @@ def test_it_should_return_422_when_mission_impact_is_not_MissionImpactEnum(

request = {"service_mission_impact": service_mission_impact}

response = client.post(
response = client.put(
f"/pteams/{self.pteam1.pteam_id}/services/{self.service_id1}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -3803,7 +3803,7 @@ def test_it_should_return_200_when_safety_impact_is_SafetyImpactEnum_or_None(

request = {"safety_impact": safety_impact}

response = client.post(
response = client.put(
f"/pteams/{self.pteam1.pteam_id}/services/{self.service_id1}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -3835,7 +3835,7 @@ def test_it_should_return_422_when_safety_impact_is_not_SafetyImpactEnum(

request = {"safety_impact": safety_impact}

response = client.post(
response = client.put(
f"/pteams/{self.pteam1.pteam_id}/services/{self.service_id1}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -3931,7 +3931,7 @@ def test_alert_by_mail_if_vulnerabilities_are_found_when_updating_service(
}

send_alert_to_pteam = mocker.patch("app.common.send_alert_to_pteam")
response = client.post(
response = client.put(
f"/pteams/{self.pteam0.pteam_id}/services/{self.service_id0}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -3976,7 +3976,7 @@ def test_not_alert_by_mail_if_unchange_ssvc_priority_when_updating_service(
}

send_alert_to_pteam = mocker.patch("app.common.send_alert_to_pteam")
response = client.post(
response = client.put(
f"/pteams/{self.pteam0.pteam_id}/services/{self.service_id0}",
headers=_headers,
json=request,
Expand Down Expand Up @@ -4014,7 +4014,7 @@ def test_not_alert_with_current_ticket_status_is_completed(self, mocker):
"safety_impact": models.SafetyImpactEnum.CATASTROPHIC.value,
}
send_alert_to_pteam = mocker.patch("app.common.send_alert_to_pteam")
response = client.post(
response = client.put(
f"/pteams/{self.pteam0.pteam_id}/services/{self.service_id0}",
headers=_headers,
json=request,
Expand All @@ -4040,7 +4040,7 @@ def test_not_alert_when_ssvc_deployer_priority_is_lower_than_alert_ssvc_priority
}

send_alert_to_pteam = mocker.patch("app.common.send_alert_to_pteam")
response = client.post(
response = client.put(
f"/pteams/{self.pteam0.pteam_id}/services/{self.service_id0}",
headers=_headers,
json=request,
Expand Down
Loading