From face495ca199fe8b476b86720233e409e8a98e5c Mon Sep 17 00:00:00 2001 From: Anjala Katuri Date: Wed, 19 Apr 2023 01:03:44 -0600 Subject: [PATCH 1/2] update login tests --- tests/test_before_login.py | 22 ++++++++++++++-------- tests/test_root.py | 6 +++--- tests/test_user.py | 18 ++++++------------ 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tests/test_before_login.py b/tests/test_before_login.py index b6de1786..6442c55a 100644 --- a/tests/test_before_login.py +++ b/tests/test_before_login.py @@ -6,23 +6,29 @@ class TestBeforeLogin(TestCase): def test_before_login(self): + headers = {"Accept": "text/plain"} # test_post_bad_login(self): test_print("test_post_bad_login starting") bad_login_info = {'email' : 'bademail', 'password' : 'test'} - compare_post_request("/login", bad_login_info, test_name='bad_admin_login') + compare_post_request("/login", bad_login_info, test_name='bad_email', headers=headers) test_print("test_post_bad_login completed") - # test_no_username_login(self): + test_print("test_post_login starting") + not_registered_email = {'email' : 'test7@user.synbiohub', + 'password' : 'test'} + compare_post_request("/login", not_registered_email, test_name='not_registered_email', headers=headers) + + #test_no_username_login(self): test_print("test_no_username_login starting") no_email_info = {'password' : 'test'} - compare_post_request("/login", no_email_info, test_name='no_email_login') + compare_post_request("/login", no_email_info, test_name='no_email_login', headers = headers) test_print("test_no_username_login completed") # test_post_login_admin(self): - test_print("test_post_login_admin starting") - logininfo = {'email' : 'test@user.synbiohub', - 'password' : 'test'} - compare_post_request("/login", logininfo) - test_print("test_post_login_admin completed") + # test_print("test_post_login_admin starting") + # logininfo = {'email' : 'test@user.synbiohub', + # 'password' : 'test'} + # compare_post_request("/login", logininfo) + # test_print("test_post_login_admin completed") diff --git a/tests/test_root.py b/tests/test_root.py index 540c86a9..d8e54d55 100644 --- a/tests/test_root.py +++ b/tests/test_root.py @@ -17,9 +17,9 @@ def test_root(): firstTimeSetup.test_post() # no commented tests - # from test_before_login import TestBeforeLogin - # testBeforeLogin = TestBeforeLogin() - # testBeforeLogin.test_before_login() + from test_before_login import TestBeforeLogin + testBeforeLogin = TestBeforeLogin() + testBeforeLogin.test_before_login() # no commented tests from test_user import TestUser diff --git a/tests/test_user.py b/tests/test_user.py index 29bd954c..3e428f13 100644 --- a/tests/test_user.py +++ b/tests/test_user.py @@ -17,24 +17,19 @@ def test_post_register(self): 'password1' : 'test', 'password2' : 'test' } - + compare_post_request("register", data, test_name = "register1", headers = headers, route_parameters = [], files = None, test_type = test_type) #error - account already in use? - FAIL CASE for 1 + test_print("test_post_register completed") - #logininfo = {'email' : 'test2@user.synbiohub', - #'password' : 'test1'} - #login_with(logininfo, 1) - #login_with(logininfo, 3) test_print("test_post_login starting") - logininfo = {'email' : 'test7@user.synbiohub', - 'password' : 'test'} - login_with(logininfo, 0) logininfo = {'email' : 'test1@user.synbiohub', 'password' : 'test'} login_with(logininfo, 1) - test_print("test_post_login completed") - test_print("test_post_register starting") + test_print("test_post_login completed") + + test_print("test_post_profile starting") compare_get_request_json("/profile", headers = headers, route_parameters = [], test_type = test_type, fields=["name", "username", "email", "affiliation", "graphUri"]) data={ @@ -45,9 +40,8 @@ def test_post_register(self): 'password2' : 'test' } - #uncomment when profile works compare_post_request("profile", data, test_name = "profile2", headers = headers, route_parameters = [], files = None, test_type = test_type) - + test_print("test_post_profile completed") #compare_get_request("/logout") # test_print("logout started") # data={ From 8c1f02cb62b455bec22d5c15446b4b136ff777cc Mon Sep 17 00:00:00 2001 From: anjalakaturi <59932615+anjalakaturi@users.noreply.github.com> Date: Tue, 30 May 2023 17:04:40 -0600 Subject: [PATCH 2/2] Update test_before_login.py --- tests/test_before_login.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/test_before_login.py b/tests/test_before_login.py index 6442c55a..0558f9db 100644 --- a/tests/test_before_login.py +++ b/tests/test_before_login.py @@ -8,17 +8,11 @@ class TestBeforeLogin(TestCase): def test_before_login(self): headers = {"Accept": "text/plain"} - # test_post_bad_login(self): - test_print("test_post_bad_login starting") - bad_login_info = {'email' : 'bademail', - 'password' : 'test'} - compare_post_request("/login", bad_login_info, test_name='bad_email', headers=headers) - test_print("test_post_bad_login completed") - - test_print("test_post_login starting") + test_print("test_not_registered_email starting") not_registered_email = {'email' : 'test7@user.synbiohub', 'password' : 'test'} compare_post_request("/login", not_registered_email, test_name='not_registered_email', headers=headers) + test_print("test_not_registered_email completed") #test_no_username_login(self): test_print("test_no_username_login starting")