aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNavan Chauhan <navanchauhan@gmail.com>2021-06-04 15:18:39 +0530
committerNavan Chauhan <navanchauhan@gmail.com>2021-06-04 15:18:39 +0530
commit350dc6430a35696efaaa4d5d736f3faed9be73ae (patch)
tree5b5832374eb403c62afa1f8ebfacebbf59a06f07
parent7df72bb7d053f05599a04922107512bd239f382f (diff)
added auth view
-rw-r--r--app/tests/test_views.py44
1 files changed, 43 insertions, 1 deletions
diff --git a/app/tests/test_views.py b/app/tests/test_views.py
index 1ce1cf2..5f6d938 100644
--- a/app/tests/test_views.py
+++ b/app/tests/test_views.py
@@ -30,4 +30,46 @@ def test_visitors(app, client):
res = client.get(page)
print("Testing %s",page)
assert res.status_code == data2check_visitors[page]["code"]
- assert data2check_visitors[page]["data"] in res.data \ No newline at end of file
+ assert data2check_visitors[page]["data"] in res.data
+
+def test_user_auth_flow(app, client):
+ res = client.post("/signup",data=dict(
+ email="test@example.com",
+ first_name="John",
+ 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
+
+ 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")
+ res = client.post("/signin",data=dict(
+ email="testtest@example.com",
+ password="123456"),follow_redirects=True)
+ assert res.status_code == 200
+ assert b"Incorrect Email" in res.data
+ res = client.post("/signin",data=dict(
+ email="test@example.com",
+ password="incorrectpassword"),
+ follow_redirects = True)
+ assert res.status_code == 200
+ assert b"Incorrect Password" in res.data
+
+ res = client.post("/signup",data=dict(
+ email="test@example.com",
+ first_name="John",
+ password="testpassword",
+ ), follow_redirects=True)
+ assert res.status_code == 200
+ assert b"Oops! An account with that email already exists" in res.data \ No newline at end of file