Browse Source

Improve error message

Son NK 5 years ago
parent
commit
c6db8db4a1
2 changed files with 3 additions and 3 deletions
  1. 2 2
      app/api/views/new_custom_alias.py
  2. 1 1
      tests/api/test_new_custom_alias.py

+ 2 - 2
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,
         )

+ 1 - 1
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"
     }