Prevent users from nulling out profile values (#1125)

* Prevent users from nulling out profile values
This commit is contained in:
Kevin Chung
2019-10-02 01:22:54 -04:00
committed by GitHub
parent b8c1970b8e
commit b15f1787e4
4 changed files with 45 additions and 0 deletions

View File

@@ -379,6 +379,14 @@ def test_api_team_patch_me_logged_in_admin_captain():
app.db.session.commit()
with login_as_user(app, name="admin") as client:
# Users can't null out their team name
r = client.patch(
"/api/v1/teams/me", json={"name": None}
)
resp = r.get_json()
assert r.status_code == 400
assert resp["errors"]["name"] == ["Field may not be null."]
r = client.patch(
"/api/v1/teams/me", json={"name": "team_name", "affiliation": "changed"}
)