aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/tests/conftest.py2
-rw-r--r--app/tests/test_views.py19
2 files changed, 20 insertions, 1 deletions
diff --git a/app/tests/conftest.py b/app/tests/conftest.py
index 1da24d3..0fd1ef1 100644
--- a/app/tests/conftest.py
+++ b/app/tests/conftest.py
@@ -9,6 +9,8 @@ import os
def app():
flask_app.config['WTF_CSRF_ENABLED'] = False
flask_app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///" + tempfile.mkstemp(suffix='.db')[-1]
+ flask_app.config['MAIL_BACKEND'] = "file" #"locmem"
+ flask_app.config["MAIL_FILE_PATH"] = '/tmp/app-messages'
db.create_all()
yield flask_app
diff --git a/app/tests/test_views.py b/app/tests/test_views.py
index dbf8cb5..a9645b2 100644
--- a/app/tests/test_views.py
+++ b/app/tests/test_views.py
@@ -1,3 +1,7 @@
+from itsdangerous.url_safe import URLSafeSerializer
+from app import app as flask_app
+ts = URLSafeSerializer(flask_app.config["SECRET_KEY"])
+
data2check_visitors = {
"/index": {
"code": 200, "data": b"Nice Tagline"
@@ -46,8 +50,21 @@ def test_user_auth_flow(app, client):
), follow_redirects=True)
assert res.status_code == 200
+ assert b"confirm your email" in res.data
+
+ confirmation_token = ts.dumps("test@example.com",salt="email-confirm-key")
+ res = client.get("/confirm?confirmation_token={}".format(confirmation_token),
+ follow_redirects=True)
+ print(res.data)
+ assert b"Succesfully Verified" in res.data
+
+ res = client.post("/signin",data=dict(
+ email="test@example.com",
+ password="testpassword"),
+ follow_redirects=True)
+ assert res.status_code == 200
assert b"Hi John" in res.data
-
+
res = client.get("/logout", follow_redirects=True)
assert res.status_code == 200
assert b"You have been logged out." in res.data