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:
|
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
|
A typical JSON response for when another user with the same
|
||||||
email address already exists in the realm:
|
email address already exists in the realm:
|
||||||
|
|
||||||
```
|
{generate_code_example|create-user|fixture(email_already_used_error)}
|
||||||
{
|
|
||||||
'msg':"Email 'newbie@zulip.com' already in use",
|
|
||||||
'result':'error'
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
|
@ -149,8 +149,14 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"create-user": {
|
"create-user": {
|
||||||
"msg":"",
|
"successful_response": {
|
||||||
"result":"success"
|
"msg":"",
|
||||||
|
"result":"success"
|
||||||
|
},
|
||||||
|
"email_already_used_error": {
|
||||||
|
"msg": "Email 'newbie@zulip.com' already in use",
|
||||||
|
"result": "error"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"get-profile": {
|
"get-profile": {
|
||||||
"client_id":"74c768b081076fdb3c4326256c17467e",
|
"client_id":"74c768b081076fdb3c4326256c17467e",
|
||||||
|
|
|
@ -108,7 +108,13 @@ def create_user(client):
|
||||||
result = client.create_user(request)
|
result = client.create_user(request)
|
||||||
# {code_example|end}
|
# {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)
|
test_against_fixture(result, fixture)
|
||||||
|
|
||||||
def get_members(client):
|
def get_members(client):
|
||||||
|
|
Loading…
Reference in New Issue