return "block_forward" for /api/aliases/{alias.id}/contacts
This commit is contained in:
parent
d81e9fb75f
commit
31e39314d5
|
@ -104,6 +104,7 @@ def serialize_contact(contact: Contact, existed=False) -> dict:
|
||||||
"reverse_alias": contact.website_send_to(),
|
"reverse_alias": contact.website_send_to(),
|
||||||
"reverse_alias_address": contact.reply_email,
|
"reverse_alias_address": contact.reply_email,
|
||||||
"existed": existed,
|
"existed": existed,
|
||||||
|
"block_forward": contact.block_forward,
|
||||||
}
|
}
|
||||||
|
|
||||||
email_log: EmailLog = contact.last_reply()
|
email_log: EmailLog = contact.last_reply()
|
||||||
|
|
|
@ -497,7 +497,8 @@ If success, 200 with the list of contacts, for example:
|
||||||
"creation_timestamp": 1582284900,
|
"creation_timestamp": 1582284900,
|
||||||
"last_email_sent_date": null,
|
"last_email_sent_date": null,
|
||||||
"last_email_sent_timestamp": null,
|
"last_email_sent_timestamp": null,
|
||||||
"reverse_alias": "marketing at example.com <reply+bzvpazcdedcgcpztehxzgjgzmxskqa@sl.co>"
|
"reverse_alias": "marketing at example.com <reply+bzvpazcdedcgcpztehxzgjgzmxskqa@sl.co>",
|
||||||
|
"block_forward": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": 2,
|
"id": 2,
|
||||||
|
@ -507,7 +508,8 @@ If success, 200 with the list of contacts, for example:
|
||||||
"last_email_sent_date": "2020-02-21 11:35:00+00:00",
|
"last_email_sent_date": "2020-02-21 11:35:00+00:00",
|
||||||
"last_email_sent_timestamp": 1582284900,
|
"last_email_sent_timestamp": 1582284900,
|
||||||
"reverse_alias": "newsletter at example.com <reply+bzvpazcdedcgcpztehxzgjgzmxskqa@sl.co>",
|
"reverse_alias": "newsletter at example.com <reply+bzvpazcdedcgcpztehxzgjgzmxskqa@sl.co>",
|
||||||
"reverse_alias_address": "reply+bzvpazcdedcgcpztehxzgjgzmxskqa@sl.co"
|
"reverse_alias_address": "reply+bzvpazcdedcgcpztehxzgjgzmxskqa@sl.co",
|
||||||
|
"block_forward": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -465,14 +465,7 @@ def test_update_pinned(flask_client):
|
||||||
|
|
||||||
|
|
||||||
def test_alias_contacts(flask_client):
|
def test_alias_contacts(flask_client):
|
||||||
user = User.create(
|
user = login(flask_client)
|
||||||
email="a@b.c", password="password", name="Test User", activated=True
|
|
||||||
)
|
|
||||||
Session.commit()
|
|
||||||
|
|
||||||
# create api_key
|
|
||||||
api_key = ApiKey.create(user.id, "for test")
|
|
||||||
Session.commit()
|
|
||||||
|
|
||||||
alias = Alias.create_new_random(user)
|
alias = Alias.create_new_random(user)
|
||||||
Session.commit()
|
Session.commit()
|
||||||
|
@ -495,10 +488,7 @@ def test_alias_contacts(flask_client):
|
||||||
)
|
)
|
||||||
Session.commit()
|
Session.commit()
|
||||||
|
|
||||||
r = flask_client.get(
|
r = flask_client.get(f"/api/aliases/{alias.id}/contacts?page_id=0")
|
||||||
url_for("api.get_alias_contacts_route", alias_id=alias.id, page_id=0),
|
|
||||||
headers={"Authentication": api_key.code},
|
|
||||||
)
|
|
||||||
|
|
||||||
assert r.status_code == 200
|
assert r.status_code == 200
|
||||||
assert len(r.json["contacts"]) == PAGE_LIMIT
|
assert len(r.json["contacts"]) == PAGE_LIMIT
|
||||||
|
@ -510,12 +500,10 @@ def test_alias_contacts(flask_client):
|
||||||
assert ac["contact"]
|
assert ac["contact"]
|
||||||
assert ac["reverse_alias"]
|
assert ac["reverse_alias"]
|
||||||
assert ac["reverse_alias_address"]
|
assert ac["reverse_alias_address"]
|
||||||
|
assert "block_forward" in ac
|
||||||
|
|
||||||
# second page, should return 1 result only
|
# second page, should return 1 result only
|
||||||
r = flask_client.get(
|
r = flask_client.get(f"/api/aliases/{alias.id}/contacts?page_id=1")
|
||||||
url_for("api.get_alias_contacts_route", alias_id=alias.id, page_id=1),
|
|
||||||
headers={"Authentication": api_key.code},
|
|
||||||
)
|
|
||||||
assert len(r.json["contacts"]) == 1
|
assert len(r.json["contacts"]) == 1
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue