skip existing users on bulk user creation

rather than aborting if any already exist

if no users are to be created, throw 400
This commit is contained in:
Min RK
2015-05-06 15:24:34 -07:00
parent c9d02382e3
commit 612cc73c3c
2 changed files with 19 additions and 2 deletions

View File

@@ -177,6 +177,17 @@ def test_add_multi_user(app):
data=json.dumps({'usernames': names}),
)
assert r.status_code == 400
names = ['a', 'b', 'ab']
# try to create the same users again
r = api_request(app, 'users', method='post',
data=json.dumps({'usernames': names}),
)
assert r.status_code == 201
reply = r.json()
r_names = [ user['name'] for user in reply ]
assert r_names == ['ab']
def test_add_multi_user_admin(app):