From c6db8db4a1fffc1fb75fc07700dff068dcf90607 Mon Sep 17 00:00:00 2001 From: Son NK Date: Sun, 5 Jan 2020 21:14:40 +0100 Subject: [PATCH] Improve error message --- app/api/views/new_custom_alias.py | 4 ++-- tests/api/test_new_custom_alias.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/api/views/new_custom_alias.py b/app/api/views/new_custom_alias.py index 86b2919a..767020f5 100644 --- a/app/api/views/new_custom_alias.py +++ b/app/api/views/new_custom_alias.py @@ -3,7 +3,7 @@ from flask import jsonify, request from flask_cors import cross_origin from app.api.base import api_bp, verify_api_key -from app.config import EMAIL_DOMAIN +from app.config import EMAIL_DOMAIN, MAX_NB_EMAIL_FREE_PLAN from app.extensions import db from app.log import LOG from app.models import GenEmail, AliasUsedOn @@ -31,7 +31,7 @@ def new_custom_alias(): return ( jsonify( error="You have reached the limitation of a free account with the maximum of " - "3 custom aliases, please upgrade your plan to create more custom aliases" + f"{MAX_NB_EMAIL_FREE_PLAN} aliases, please upgrade your plan to create more aliases" ), 400, ) diff --git a/tests/api/test_new_custom_alias.py b/tests/api/test_new_custom_alias.py index 35ae512c..4dabd645 100644 --- a/tests/api/test_new_custom_alias.py +++ b/tests/api/test_new_custom_alias.py @@ -48,5 +48,5 @@ def test_out_of_quota(flask_client): assert r.status_code == 400 assert r.json == { - "error": "You have reached the limitation of a free account with the maximum of 3 custom aliases, please upgrade your plan to create more custom aliases" + "error": "You have reached the limitation of a free account with the maximum of 3 aliases, please upgrade your plan to create more aliases" }