add "in_trial" to /user_info

This commit is contained in:
Son NK 2020-03-18 19:08:16 +01:00 committed by Son NK
parent 46701530db
commit 7d61c5d8c2
3 changed files with 14 additions and 3 deletions

View file

@ -651,7 +651,8 @@ Output: if api key is correct, return a json with user name and whether user is
{
"name": "John Wick",
"is_premium": false,
"email": "john@wick.com"
"email": "john@wick.com",
"in_trial": true
}
```

View file

@ -14,5 +14,10 @@ def user_info():
user = g.user
return jsonify(
{"name": user.name, "is_premium": user.is_premium(), "email": user.email}
{
"name": user.name,
"is_premium": user.is_premium(),
"email": user.email,
"in_trial": user.in_trial(),
}
)

View file

@ -19,7 +19,12 @@ def test_user_in_trial(flask_client):
)
assert r.status_code == 200
assert r.json == {"is_premium": True, "name": "Test User", "email": "a@b.c"}
assert r.json == {
"is_premium": True,
"name": "Test User",
"email": "a@b.c",
"in_trial": True,
}
def test_wrong_api_key(flask_client):