aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMuriithi Frederick Muriuki2018-02-19 14:12:59 +0300
committerPjotr Prins2018-03-26 09:29:29 +0000
commite4b7e72d83a6dba40a38c58e62e338bd257862ef (patch)
tree18495eca36d66be44bc8493750f26766cbc8b60b
parentdb86c21577e50b30ee222c47aae43e49a574c007 (diff)
downloadgenenetwork2-e4b7e72d83a6dba40a38c58e62e338bd257862ef.tar.gz
Add more login tests.
-rw-r--r--test/requests/test_login_local.py39
-rw-r--r--wqflask/wqflask/user_manager.py2
2 files changed, 37 insertions, 4 deletions
diff --git a/test/requests/test_login_local.py b/test/requests/test_login_local.py
index bced1ee9..acad45c9 100644
--- a/test/requests/test_login_local.py
+++ b/test/requests/test_login_local.py
@@ -32,12 +32,47 @@ class TestLoginLocal(ParametrizedTest):
"password": "test_password"
}
result = requests.post(self.login_url, data=data)
- print("THE COOKIES? ", result.cookies)
self.assertEqual(
result.url
, self.gn2_url+"/?import_collections=false"
, "Login should have been successful")
-
+
+ def testLoginWithRegisteredUserImportCollectionsTrueAndRememberMeFalse(self):
+ data = {
+ "email_address": "test@user.com",
+ "password": "test_password",
+ "import_collections": "y"
+ }
+ result = requests.post(self.login_url, data=data)
+ self.assertEqual(
+ result.url
+ , self.gn2_url+"/?import_collections=true"
+ , "Login should have been successful")
+
+ def testLoginWithRegisteredUserImportCollectionsFalseAndRememberMeTrue(self):
+ data = {
+ "email_address": "test@user.com",
+ "password": "test_password",
+ "remember_me": "y"
+ }
+ result = requests.post(self.login_url, data=data)
+ self.assertEqual(
+ result.url
+ , self.gn2_url+"/?import_collections=false"
+ , "Login should have been successful")
+
+ def testLoginWithRegisteredUserBothImportCollectionsAndRememberMeTrue(self):
+ data = {
+ "email_address": "test@user.com",
+ "password": "test_password",
+ "remember_me": "y",
+ "import_collections": "y"
+ }
+ result = requests.post(self.login_url, data=data)
+ self.assertEqual(
+ result.url
+ , self.gn2_url+"/?import_collections=true"
+ , "Login should have been successful")
def main(gn2, es):
diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py
index c8471cb1..fd1d56ff 100644
--- a/wqflask/wqflask/user_manager.py
+++ b/wqflask/wqflask/user_manager.py
@@ -642,7 +642,6 @@ class LoginUser(object):
user = model.User();
for key in user_details:
user.__dict__[key] = user_details[key]
- print("RETRIEVED USER: ", user)
valid = False;
submitted_password = params['password']
@@ -689,7 +688,6 @@ class LoginUser(object):
"""The meat of the logging in process"""
session_id_signed = self.successful_login(user, assumed_by)
flash("Thank you for logging in {}.".format(user.full_name), "alert-success")
- print("IMPORT1:", import_collections)
response = make_response(redirect(url_for('index_page', import_collections=import_collections)))
if self.remember_me:
max_age = self.remember_time