mirror of https://github.com/zulip/zulip.git
api/create-user: Test fixture for "email already in use" error.
In templates/zerver/api/create-user.md, we have a sample fixture for when a client attempts to create a user with the same email as an existing user. This commit adds a test for that fixture. Note that this error payload is specific to client.create_user and this error payload isn't generated anywhere else.
This commit is contained in:
parent
be0a04f33e
commit
a0818975fb
|
@ -72,15 +72,9 @@ zulip(config).then((client) => {
|
|||
|
||||
A typical successful JSON response may look like:
|
||||
|
||||
{generate_code_example|create-user|fixture}
|
||||
|
||||
{generate_code_example|create-user|fixture(successful_response)}
|
||||
|
||||
A typical JSON response for when another user with the same
|
||||
email address already exists in the realm:
|
||||
|
||||
```
|
||||
{
|
||||
'msg':"Email 'newbie@zulip.com' already in use",
|
||||
'result':'error'
|
||||
}
|
||||
```
|
||||
{generate_code_example|create-user|fixture(email_already_used_error)}
|
||||
|
|
|
@ -149,9 +149,15 @@
|
|||
]
|
||||
},
|
||||
"create-user": {
|
||||
"successful_response": {
|
||||
"msg":"",
|
||||
"result":"success"
|
||||
},
|
||||
"email_already_used_error": {
|
||||
"msg": "Email 'newbie@zulip.com' already in use",
|
||||
"result": "error"
|
||||
}
|
||||
},
|
||||
"get-profile": {
|
||||
"client_id":"74c768b081076fdb3c4326256c17467e",
|
||||
"email":"iago@zulip.com",
|
||||
|
|
|
@ -108,7 +108,13 @@ def create_user(client):
|
|||
result = client.create_user(request)
|
||||
# {code_example|end}
|
||||
|
||||
fixture = FIXTURES['create-user']
|
||||
fixture = FIXTURES['create-user']['successful_response']
|
||||
test_against_fixture(result, fixture)
|
||||
|
||||
# Test "Email already used error"
|
||||
result = client.create_user(request)
|
||||
|
||||
fixture = FIXTURES['create-user']['email_already_used_error']
|
||||
test_against_fixture(result, fixture)
|
||||
|
||||
def get_members(client):
|
||||
|
|
Loading…
Reference in New Issue