add "in_trial" to /user_info

This commit is contained in:
Son NK 2020-03-18 19:08:16 +01:00
parent f2d5230449
commit 2079b16431
3 changed files with 14 additions and 3 deletions

View File

@ -634,7 +634,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):