diff options
author | Navan Chauhan <navanchauhan@gmail.com> | 2021-06-04 01:37:43 +0530 |
---|---|---|
committer | Navan Chauhan <navanchauhan@gmail.com> | 2021-06-04 01:37:43 +0530 |
commit | e7634cb0f7d7bf021fd518e64d472d8b9929086c (patch) | |
tree | 0b163c4c11a78f572e73a6f5d9d64bef5f548ecf | |
parent | 7e3343935632a13c8d0780409d1d823e22d7eade (diff) |
add simple views test
-rw-r--r-- | app/tests/test_views.py | 33 |
1 files changed, 33 insertions, 0 deletions
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 |