return mailbox in GET /api/v2/aliases
This commit is contained in:
parent
c8ed1437f1
commit
88ddca54c1
11
README.md
11
README.md
|
@ -852,6 +852,9 @@ If success, 200 with the list of aliases. Each alias has the following fields:
|
||||||
- nb_block
|
- nb_block
|
||||||
- nb_forward
|
- nb_forward
|
||||||
- nb_reply
|
- nb_reply
|
||||||
|
- mailbox
|
||||||
|
- id
|
||||||
|
- email
|
||||||
- (optional) latest_activity:
|
- (optional) latest_activity:
|
||||||
- action: forward|reply|block|bounced
|
- action: forward|reply|block|bounced
|
||||||
- timestamp
|
- timestamp
|
||||||
|
@ -871,6 +874,10 @@ Here's an example:
|
||||||
"email": "prefix1.cat@sl.local",
|
"email": "prefix1.cat@sl.local",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"id": 3,
|
"id": 3,
|
||||||
|
"mailbox": {
|
||||||
|
"email": "a@b.c",
|
||||||
|
"id": 1
|
||||||
|
},
|
||||||
"latest_activity": {
|
"latest_activity": {
|
||||||
"action": "forward",
|
"action": "forward",
|
||||||
"contact": {
|
"contact": {
|
||||||
|
@ -891,6 +898,10 @@ Here's an example:
|
||||||
"email": "prefix0.hey@sl.local",
|
"email": "prefix0.hey@sl.local",
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"id": 2,
|
"id": 2,
|
||||||
|
"mailbox": {
|
||||||
|
"email": "a@b.c",
|
||||||
|
"id": 1
|
||||||
|
},
|
||||||
"latest_activity": {
|
"latest_activity": {
|
||||||
"action": "forward",
|
"action": "forward",
|
||||||
"contact": {
|
"contact": {
|
||||||
|
|
|
@ -51,6 +51,11 @@ def serialize_alias_info_v2(alias_info: AliasInfo) -> dict:
|
||||||
"nb_forward": alias_info.nb_forward,
|
"nb_forward": alias_info.nb_forward,
|
||||||
"nb_block": alias_info.nb_blocked,
|
"nb_block": alias_info.nb_blocked,
|
||||||
"nb_reply": alias_info.nb_reply,
|
"nb_reply": alias_info.nb_reply,
|
||||||
|
# mailbox
|
||||||
|
"mailbox": {
|
||||||
|
"id": alias_info.mailbox.id,
|
||||||
|
"email": alias_info.mailbox.email
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if alias_info.latest_email_log:
|
if alias_info.latest_email_log:
|
||||||
email_log = alias_info.latest_email_log
|
email_log = alias_info.latest_email_log
|
||||||
|
|
|
@ -150,9 +150,9 @@ def test_get_aliases_v2(flask_client):
|
||||||
r0 = r.json["aliases"][0]
|
r0 = r.json["aliases"][0]
|
||||||
# r0 will have the following format
|
# r0 will have the following format
|
||||||
# {
|
# {
|
||||||
# "creation_date": "2020-04-06 17:52:47+00:00",
|
# "creation_date": "2020-04-25 21:10:01+00:00",
|
||||||
# "creation_timestamp": 1586195567,
|
# "creation_timestamp": 1587849001,
|
||||||
# "email": "prefix1.hey@sl.local",
|
# "email": "prefix1.yeah@sl.local",
|
||||||
# "enabled": true,
|
# "enabled": true,
|
||||||
# "id": 3,
|
# "id": 3,
|
||||||
# "latest_activity": {
|
# "latest_activity": {
|
||||||
|
@ -162,7 +162,11 @@ def test_get_aliases_v2(flask_client):
|
||||||
# "name": null,
|
# "name": null,
|
||||||
# "reverse_alias": "\"c1 at example.com\" <re1@SL>"
|
# "reverse_alias": "\"c1 at example.com\" <re1@SL>"
|
||||||
# },
|
# },
|
||||||
# "timestamp": 1586195567
|
# "timestamp": 1587849001
|
||||||
|
# },
|
||||||
|
# "mailbox": {
|
||||||
|
# "email": "a@b.c",
|
||||||
|
# "id": 1
|
||||||
# },
|
# },
|
||||||
# "nb_block": 0,
|
# "nb_block": 0,
|
||||||
# "nb_forward": 1,
|
# "nb_forward": 1,
|
||||||
|
@ -177,6 +181,9 @@ def test_get_aliases_v2(flask_client):
|
||||||
assert "name" in r0["latest_activity"]["contact"]
|
assert "name" in r0["latest_activity"]["contact"]
|
||||||
assert "reverse_alias" in r0["latest_activity"]["contact"]
|
assert "reverse_alias" in r0["latest_activity"]["contact"]
|
||||||
|
|
||||||
|
assert "id" in r0["mailbox"]
|
||||||
|
assert "email" in r0["mailbox"]
|
||||||
|
|
||||||
|
|
||||||
def test_delete_alias(flask_client):
|
def test_delete_alias(flask_client):
|
||||||
user = User.create(
|
user = User.create(
|
||||||
|
|
Loading…
Reference in a new issue