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

API call /maintenance/{mw_id} on PATCH is returning misleading response status #10

Closed
ajoaoff opened this issue Jun 8, 2021 · 0 comments · Fixed by #12
Closed

API call /maintenance/{mw_id} on PATCH is returning misleading response status #10

ajoaoff opened this issue Jun 8, 2021 · 0 comments · Fixed by #12
Labels
2022.1 Kytos-ng 2022.1

Comments

@ajoaoff
Copy link

ajoaoff commented Jun 8, 2021

Original issue opened by @ArturoQuintana at kytos#44.

  • The action to PATCH a payload where the items field is empty is returning 201 when it should be 400.

Example:
payload1 = {
"start": start.strftime(TIME_FMT),
"end": new_time.strftime(TIME_FMT)
}
mw_api_url = KYTOS_API + '/maintenance/' + mw_id
request = requests.patch(mw_api_url, data=json.dumps(payload1), headers={'Content-type': 'application/json'})

Reflected on end-to-end test:
tests/test_e2e_15_maintenance.py::TestE2EMaintenance::test_036_patch_mw_on_switch_should_fail_wrong_payload_items_empty

  • The action to PATCH a payload with no items field is returning 201 when it should be 400.

Example:
payload1 = {
"start": start.strftime(TIME_FMT),
"end": new_time.strftime(TIME_FMT)
}
mw_api_url = KYTOS_API + '/maintenance/' + mw_id
request = requests.patch(mw_api_url, data=json.dumps(payload1), headers={'Content-type': 'application/json'})

Reflected on end-to-end test:
tests/test_e2e_15_maintenance.py::TestE2EMaintenance::test_038_patch_mw_on_switch_should_fail_wrong_payload_no_items_field

  • A PATCH action using a not serializable JSON broke the application, and it should return a 400 error.

Example:
payload1 = {
"description"
}
mw_api_url = KYTOS_API + '/maintenance/' + mw_id
request = requests.patch(mw_api_url, data=json.dumps(payload1), headers={'Content-type': 'application/json'})

Reflected on end-to-end test: tests/test_e2e_15_maintenance.py::TestE2EMaintenance::test_039_patch_mw_on_switch_should_fail_wrong_payload

@viniarck viniarck added the 2022.1 Kytos-ng 2022.1 label Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2022.1 Kytos-ng 2022.1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants