Fix creating users from the admin panel while name changes disabled (#862)

* Fix creating users from the admin panel while name changes are disabled; clean up user & team schema validators
* Closes #832
* Coerce /api/v1/teams/<team_id> to /api/v1/teams/<int:team_id>
This commit is contained in:
Kevin Chung
2019-01-31 01:18:46 -05:00
committed by GitHub
parent 2935a76722
commit 2f49477465
7 changed files with 178 additions and 25 deletions

View File

@@ -98,7 +98,7 @@ def register_user(app, name="user", email="user@ctfd.io", password="password", r
assert sess['nonce']
def register_team(app, name="team", password="password"):
def register_team(app, name="team", password="password", raise_for_error=True):
with app.app_context():
with app.test_client() as client:
r = client.get('/team')
@@ -108,7 +108,10 @@ def register_team(app, name="team", password="password"):
"password": password,
"nonce": sess.get('nonce')
}
client.post('/teams/new', data=data)
r = client.post('/teams/new', data=data)
if raise_for_error:
assert r.status_code == 302
return client
def login_as_user(app, name="user", password="password", raise_for_error=True):