Fix missing Team API exceptions (#1058)

* Add require_team decorator to endpoints that request teams.
* Change status code for captain endpoints to return 403 instead of 400
This commit is contained in:
Kevin Chung
2019-07-12 00:53:35 -04:00
committed by GitHub
parent f033f16490
commit b453125726
4 changed files with 14 additions and 6 deletions

View File

@@ -339,7 +339,7 @@ def test_api_team_patch_me_logged_in_user():
r = client.patch(
"/api/v1/teams/me", json={"name": "team_name", "affiliation": "changed"}
)
assert r.status_code == 400
assert r.status_code == 403
destroy_ctfd(app)
@@ -640,7 +640,7 @@ def test_api_team_patch_password():
"/api/v1/teams/me",
json={"confirm": "password", "password": "new_password"},
)
assert r.status_code == 400
assert r.status_code == 403
assert r.get_json() == {
"errors": {"": ["Only team captains can edit team information"]},