return note in GET /api/aliases
This commit is contained in:
parent
5674cab390
commit
417009b3be
|
@ -806,7 +806,8 @@ If success, 200 with the list of aliases, for example:
|
|||
"nb_block": 0,
|
||||
"nb_forward": 0,
|
||||
"nb_reply": 0,
|
||||
"enabled": true
|
||||
"enabled": true,
|
||||
"note": "This is a note"
|
||||
},
|
||||
{
|
||||
"creation_date": "2020-02-04 16:23:02+00:00",
|
||||
|
@ -816,7 +817,8 @@ If success, 200 with the list of aliases, for example:
|
|||
"nb_block": 0,
|
||||
"nb_forward": 0,
|
||||
"nb_reply": 0,
|
||||
"enabled": false
|
||||
"enabled": false,
|
||||
"note": null
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@ def get_aliases():
|
|||
- nb_forward
|
||||
- nb_block
|
||||
- nb_reply
|
||||
- note
|
||||
|
||||
"""
|
||||
user = g.user
|
||||
|
@ -48,6 +49,7 @@ def get_aliases():
|
|||
"nb_block": alias.nb_blocked,
|
||||
"nb_reply": alias.nb_reply,
|
||||
"enabled": alias.gen_email.enabled,
|
||||
"note": alias.note,
|
||||
}
|
||||
for alias in aliases
|
||||
]
|
||||
|
|
|
@ -30,6 +30,7 @@ class AliasInfo:
|
|||
|
||||
show_intro_test_send_email: bool = False
|
||||
highlight: bool = False
|
||||
note: str
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
for k, v in kwargs.items():
|
||||
|
@ -230,6 +231,7 @@ def get_alias_info(
|
|||
nb_reply=0,
|
||||
highlight=ge.id == highlight_gen_email_id,
|
||||
mailbox=mb,
|
||||
note=ge.note,
|
||||
)
|
||||
|
||||
alias_info = aliases[ge.email]
|
||||
|
|
|
@ -48,6 +48,18 @@ def test_success_with_pagination(flask_client):
|
|||
assert r.status_code == 200
|
||||
assert len(r.json["aliases"]) == PAGE_LIMIT
|
||||
|
||||
# assert returned field
|
||||
for a in r.json["aliases"]:
|
||||
assert "id" in a
|
||||
assert "email" in a
|
||||
assert "creation_date" in a
|
||||
assert "creation_timestamp" in a
|
||||
assert "nb_forward" in a
|
||||
assert "nb_block" in a
|
||||
assert "nb_reply" in a
|
||||
assert "enabled" in a
|
||||
assert "note" in a
|
||||
|
||||
# get aliases on the 2nd page, should return 2 aliases
|
||||
# as the total number of aliases is PAGE_LIMIT +2
|
||||
# 1 alias is created when user is created
|
||||
|
|
Loading…
Reference in New Issue