mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-10 03:23:04 +00:00
validate usernames
via Authenticator.validate_username base class configurable with Authenticator.username_pattern
This commit is contained in:
@@ -209,6 +209,17 @@ def test_add_multi_user_bad(app):
|
||||
r = api_request(app, 'users', method='post', data='[]')
|
||||
assert r.status_code == 400
|
||||
|
||||
|
||||
def test_add_multi_user_invalid(app):
|
||||
app.authenticator.username_pattern = r'w.*'
|
||||
r = api_request(app, 'users', method='post',
|
||||
data=json.dumps({'usernames': ['Willow', 'Andrew', 'Tara']})
|
||||
)
|
||||
app.authenticator.username_pattern = ''
|
||||
assert r.status_code == 400
|
||||
assert r.json()['message'] == 'Invalid usernames: andrew, tara'
|
||||
|
||||
|
||||
def test_add_multi_user(app):
|
||||
db = app.db
|
||||
names = ['a', 'b']
|
||||
|
Reference in New Issue
Block a user