mirror of
https://github.com/simple-login/app.git
synced 2025-11-08 16:51:01 +08:00
add more fields into /api/custom_domains
This commit is contained in:
parent
c4c29dfa1d
commit
39c92110cb
3 changed files with 33 additions and 12 deletions
|
|
@ -8,9 +8,14 @@ from app.models import CustomDomain, DomainDeletedAlias
|
|||
def custom_domain_to_dict(custom_domain: CustomDomain):
|
||||
return {
|
||||
"id": custom_domain.id,
|
||||
"domain": custom_domain.domain,
|
||||
"verified": custom_domain.verified,
|
||||
"domain_name": custom_domain.domain,
|
||||
"is_verified": custom_domain.verified,
|
||||
"nb_alias": custom_domain.nb_alias(),
|
||||
"creation_date": custom_domain.created_at.format(),
|
||||
"creation_timestamp": custom_domain.created_at.timestamp,
|
||||
"catch_all": custom_domain.catch_all,
|
||||
"name": custom_domain.name,
|
||||
"random_prefix_generation": custom_domain.random_prefix_generation,
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
18
docs/api.md
18
docs/api.md
|
|
@ -633,16 +633,26 @@ List of custom domains.
|
|||
{
|
||||
"custom_domains": [
|
||||
{
|
||||
"domain": "test1.org",
|
||||
"catch_all": false,
|
||||
"creation_date": "2021-03-06 19:42:33+00:00",
|
||||
"creation_timestamp": 1615059753,
|
||||
"domain_name": "test1.org",
|
||||
"id": 1,
|
||||
"is_verified": true,
|
||||
"name": null,
|
||||
"nb_alias": 0,
|
||||
"verified": true
|
||||
"random_prefix_generation": false
|
||||
},
|
||||
{
|
||||
"domain": "test2.org",
|
||||
"catch_all": false,
|
||||
"creation_date": "2021-03-06 19:42:33+00:00",
|
||||
"creation_timestamp": 1615059753,
|
||||
"domain_name": "test2.org",
|
||||
"id": 2,
|
||||
"is_verified": false,
|
||||
"name": null,
|
||||
"nb_alias": 0,
|
||||
"verified": false
|
||||
"random_prefix_generation": false
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,12 +16,18 @@ def test_get_custom_domains(flask_client):
|
|||
)
|
||||
|
||||
assert r.status_code == 200
|
||||
assert r.json == {
|
||||
"custom_domains": [
|
||||
{"domain": "test1.org", "id": 1, "nb_alias": 0, "verified": True},
|
||||
{"domain": "test2.org", "id": 2, "nb_alias": 0, "verified": False},
|
||||
]
|
||||
}
|
||||
assert len(r.json["custom_domains"]) == 2
|
||||
for domain in r.json["custom_domains"]:
|
||||
assert domain["domain_name"]
|
||||
assert domain["id"]
|
||||
assert domain["nb_alias"] == 0
|
||||
assert "is_verified" in domain
|
||||
assert "catch_all" in domain
|
||||
assert "name" in domain
|
||||
assert "random_prefix_generation" in domain
|
||||
assert domain["creation_date"]
|
||||
assert domain["creation_timestamp"]
|
||||
|
||||
|
||||
|
||||
def test_get_custom_domain_trash(flask_client):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue