add mailboxes to GET /api/custom_domains

This commit is contained in:
Son 2021-03-10 22:37:26 +01:00
parent 6b79dbdd5c
commit 6c2daf1bb6
3 changed files with 44 additions and 26 deletions

View File

@ -16,6 +16,9 @@ def custom_domain_to_dict(custom_domain: CustomDomain):
"catch_all": custom_domain.catch_all,
"name": custom_domain.name,
"random_prefix_generation": custom_domain.random_prefix_generation,
"mailboxes": [
{"id": mb.id, "email": mb.email} for mb in custom_domain.mailboxes
],
}

View File

@ -632,32 +632,42 @@ Output:
List of custom domains.
```json
{
"custom_domains": [
{
"catch_all": false,
"creation_date": "2021-03-06 19:42:33+00:00",
"creation_timestamp": 1615059753,
"domain_name": "test1.org",
"id": 1,
"is_verified": true,
"name": null,
"nb_alias": 0,
"random_prefix_generation": false
},
{
"catch_all": false,
"creation_date": "2021-03-06 19:42:33+00:00",
"creation_timestamp": 1615059753,
"domain_name": "test2.org",
"id": 2,
"is_verified": false,
"name": null,
"nb_alias": 0,
"random_prefix_generation": false
}
]
}
[
{
"catch_all": false,
"creation_date": "2021-03-10 21:36:08+00:00",
"creation_timestamp": 1615412168,
"domain_name": "test1.org",
"id": 1,
"is_verified": true,
"mailboxes": [
{
"email": "a@b.c",
"id": 1
}
],
"name": null,
"nb_alias": 0,
"random_prefix_generation": false
},
{
"catch_all": false,
"creation_date": "2021-03-10 21:36:08+00:00",
"creation_timestamp": 1615412168,
"domain_name": "test2.org",
"id": 2,
"is_verified": false,
"mailboxes": [
{
"email": "a@b.c",
"id": 1
}
],
"name": null,
"nb_alias": 0,
"random_prefix_generation": false
}
]
```
#### GET /api/custom_domains/:custom_domain_id/trash

View File

@ -28,6 +28,11 @@ def test_get_custom_domains(flask_client):
assert domain["creation_date"]
assert domain["creation_timestamp"]
assert domain["mailboxes"]
for mailbox in domain["mailboxes"]:
assert "id" in mailbox
assert "email" in mailbox
def test_get_custom_domain_trash(flask_client):
user = login(flask_client)