return alias name in GET /api/v2/aliases

This commit is contained in:
Son NK 2020-04-26 10:38:58 +02:00
parent 7a2fc007e8
commit 63af3297f7
3 changed files with 6 additions and 0 deletions

View File

@ -870,6 +870,7 @@ If success, 200 with the list of aliases. Each alias has the following fields:
- id
- email
- name
- enabled
- creation_timestamp
- note
@ -896,6 +897,7 @@ Here's an example:
"creation_date": "2020-04-06 17:57:14+00:00",
"creation_timestamp": 1586195834,
"email": "prefix1.cat@sl.local",
"name": "A Name",
"enabled": true,
"id": 3,
"mailbox": {
@ -920,6 +922,7 @@ Here's an example:
"creation_date": "2020-04-06 17:57:14+00:00",
"creation_timestamp": 1586195834,
"email": "prefix0.hey@sl.local",
"name": null,
"enabled": true,
"id": 2,
"mailbox": {

View File

@ -47,6 +47,7 @@ def serialize_alias_info_v2(alias_info: AliasInfo) -> dict:
"creation_timestamp": alias_info.alias.created_at.timestamp,
"enabled": alias_info.alias.enabled,
"note": alias_info.alias.note,
"name": alias_info.alias.name,
# activity
"nb_forward": alias_info.nb_forward,
"nb_block": alias_info.nb_blocked,

View File

@ -155,6 +155,7 @@ def test_get_aliases_v2(flask_client):
# "email": "prefix1.yeah@sl.local",
# "enabled": true,
# "id": 3,
# "name": "Hey hey",
# "latest_activity": {
# "action": "forward",
# "contact": {
@ -173,6 +174,7 @@ def test_get_aliases_v2(flask_client):
# "nb_reply": 0,
# "note": null
# }
assert "name" in r0
assert r0["email"].startswith("prefix1")
assert r0["latest_activity"]["action"] == "forward"
assert "timestamp" in r0["latest_activity"]