From e7634cb0f7d7bf021fd518e64d472d8b9929086c Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Fri, 4 Jun 2021 01:37:43 +0530 Subject: add simple views test --- app/tests/test_views.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 app/tests/test_views.py diff --git a/app/tests/test_views.py b/app/tests/test_views.py new file mode 100644 index 0000000..1ce1cf2 --- /dev/null +++ b/app/tests/test_views.py @@ -0,0 +1,33 @@ +data2check_visitors = { + "/index": { + "code": 200, "data": b"Nice Tagline" + }, + "/": { + "code": 200, "data": b"Nice Tagline" + }, + "/ContactUs":{ + "code": 200, "data": b"send us a message." + }, + "/doesnotexists":{ + "code": 404, "data": b"Page Not Found" + }, + "/logout":{ + "code": 200, "data": b"You have been logged out." + }, + "/dashboard":{ + "code":401,"data":b"You need to be logged in to access this resource" + }, + "/signup":{ + "code":200,"data":b"Register your account." + }, + "/signin":{ + "code":200,"data":b"Sign in to your account." + } +} + +def test_visitors(app, client): + for page in data2check_visitors: + 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 -- cgit v1.2.3