return custom domain json in patch

This commit is contained in:
Son 2022-01-16 17:26:11 +01:00
parent 8ff3b5ef8e
commit 0806f9243e
3 changed files with 21 additions and 2 deletions

View File

@ -121,4 +121,6 @@ def update_custom_domain(custom_domain_id):
if changed:
Session.commit()
return jsonify(ok=True), 200
# refresh
custom_domain = CustomDomain.get(custom_domain_id)
return jsonify(custom_domain=custom_domain_to_dict(custom_domain)), 200

View File

@ -741,7 +741,7 @@ Input:
- (optional) `mailbox_ids`: array of mailbox id, in request body
Output:
If success, return 200
If success, return 200 along with updated custom domain
#### GET /api/custom_domains/:custom_domain_id/trash

View File

@ -47,6 +47,23 @@ def test_update_custom_domains(flask_client):
assert r.status_code == 200
assert d1.catch_all is True
# make sure the full domain json is returned
cd_json = r.json["custom_domain"]
assert cd_json["domain_name"]
assert cd_json["id"] == d1.id
assert cd_json["nb_alias"] == 0
assert "is_verified" in cd_json
assert "catch_all" in cd_json
assert "name" in cd_json
assert "random_prefix_generation" in cd_json
assert cd_json["creation_date"]
assert cd_json["creation_timestamp"]
assert cd_json["mailboxes"]
for mailbox in cd_json["mailboxes"]:
assert "id" in mailbox
assert "email" in mailbox
# test update random_prefix_generation
assert d1.random_prefix_generation is False
r = flask_client.patch(