return creation_timestamp in GET /mailboxes
This commit is contained in:
parent
28287ff93e
commit
0530a8aab5
|
@ -1138,7 +1138,7 @@ Input:
|
|||
- `Authentication` header that contains the api key
|
||||
|
||||
Output:
|
||||
List of mailboxes. Each mailbox has id, email, default field
|
||||
List of mailboxes. Each mailbox has id, email, default, creation_timestamp field
|
||||
|
||||
```json
|
||||
{
|
||||
|
@ -1146,12 +1146,14 @@ List of mailboxes. Each mailbox has id, email, default field
|
|||
{
|
||||
"email": "a@b.c",
|
||||
"id": 1,
|
||||
"default": true
|
||||
"default": true,
|
||||
"creation_timestamp": 1590918512
|
||||
},
|
||||
{
|
||||
"email": "m1@example.com",
|
||||
"id": 2,
|
||||
"default": false
|
||||
"default": false,
|
||||
"creation_timestamp": 1590918512
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -162,6 +162,7 @@ def get_mailboxes():
|
|||
- id
|
||||
- email
|
||||
- default: boolean - whether the mailbox is the default one
|
||||
- creation_timestamp
|
||||
"""
|
||||
user = g.user
|
||||
|
||||
|
@ -172,6 +173,7 @@ def get_mailboxes():
|
|||
"id": mb.id,
|
||||
"email": mb.email,
|
||||
"default": user.default_mailbox_id == mb.id,
|
||||
"creation_timestamp": mb.created_at.timestamp,
|
||||
}
|
||||
for mb in user.mailboxes()
|
||||
]
|
||||
|
|
|
@ -181,10 +181,11 @@ def test_get_mailboxes(flask_client):
|
|||
)
|
||||
assert r.status_code == 200
|
||||
# m2@example.com is not returned as it's not verified
|
||||
assert r.json == {
|
||||
"mailboxes": [
|
||||
{"email": "a@b.c", "id": 1, "default": True},
|
||||
{"email": "m1@example.com", "id": 2, "default": False},
|
||||
]
|
||||
}
|
||||
print(json.dumps(r.json, indent=2))
|
||||
assert len(r.json["mailboxes"]) == 2
|
||||
for mb in r.json["mailboxes"]:
|
||||
assert "email" in mb
|
||||
assert "id" in mb
|
||||
assert "default" in mb
|
||||
assert "creation_timestamp" in mb
|
||||
|
||||
print(r.json)
|
||||
|
|
Loading…
Reference in a new issue