app/tests/api/test_custom_domain.py

26 lines
642 B
Python
Raw Normal View History

2020-11-16 02:09:25 +08:00
import json
from app.models import CustomDomain
from tests.utils import login
def test_get_custom_domains(flask_client):
user = login(flask_client)
CustomDomain.create(user_id=user.id, domain="test1.org", verified=True, commit=True)
CustomDomain.create(
user_id=user.id, domain="test2.org", verified=False, commit=True
)
r = flask_client.get(
"/api/custom_domains",
)
assert r.status_code == 200
assert r.json == {
"custom_domains": [
{"domain": "test1.org", "id": 1, "verified": True},
{"domain": "test2.org", "id": 2, "verified": False},
]
}