From 9ae49cbf3167ad35be8dcba22742664ee6630959 Mon Sep 17 00:00:00 2001 From: Usman Muzaffar Date: Thu, 18 Oct 2018 09:39:09 +0100 Subject: [PATCH] Test case fixes for server mode. --- web/pgadmin/browser/tests/test_change_password.py | 6 +++--- .../browser/tests/test_gravatar_image_display.py | 4 ++++ web/pgadmin/browser/tests/test_internal_version.py | 11 +++++++---- web/pgadmin/browser/tests/test_login.py | 4 ++++ web/pgadmin/browser/tests/test_logout.py | 4 ++++ web/pgadmin/browser/tests/test_reset_password.py | 4 ++++ web/pgadmin/browser/tests/test_version_in_range.py | 4 ++++ 7 files changed, 30 insertions(+), 7 deletions(-) diff --git a/web/pgadmin/browser/tests/test_change_password.py b/web/pgadmin/browser/tests/test_change_password.py index 5b337db71..0ccfdeb90 100644 --- a/web/pgadmin/browser/tests/test_change_password.py +++ b/web/pgadmin/browser/tests/test_change_password.py @@ -94,13 +94,13 @@ class ChangePasswordTestCase(BaseTestGenerator): if 'valid_password' in dir(self): response = self.tester.post( '/user_management/user/', - data=dict( + data=json.dumps(dict( email=self.username, newPassword=self.password, confirmPassword=self.password, - active=1, + active=True, role="2" - ), + )), follow_redirects=True ) user_id = json.loads(response.data.decode('utf-8'))['id'] diff --git a/web/pgadmin/browser/tests/test_gravatar_image_display.py b/web/pgadmin/browser/tests/test_gravatar_image_display.py index a4526c9d9..084c70649 100644 --- a/web/pgadmin/browser/tests/test_gravatar_image_display.py +++ b/web/pgadmin/browser/tests/test_gravatar_image_display.py @@ -43,6 +43,10 @@ class TestLoginUserImage(BaseTestGenerator): "Logout first if already logged in" utils.logout_tester_account(cls.tester) + # No need to call baseclass setup function + def setUp(self): + pass + def runTest(self): # Login and check type of image in response response = self.tester.post( diff --git a/web/pgadmin/browser/tests/test_internal_version.py b/web/pgadmin/browser/tests/test_internal_version.py index b90f900bf..5954bb9bb 100644 --- a/web/pgadmin/browser/tests/test_internal_version.py +++ b/web/pgadmin/browser/tests/test_internal_version.py @@ -15,6 +15,7 @@ from pgadmin import create_app class InternalVersionTestCase(BaseTestGenerator): """ + This test case verifies application creation with new versions parameters """ scenarios = [ ('TestCase with INTERNAL_VERSION_PARAM none', dict( @@ -47,12 +48,14 @@ class InternalVersionTestCase(BaseTestGenerator): self.config_bak = config def runTest(self): + # assign config file parameters new values config.APP_VERSION_INT = self.app_version - config.INTERNAL_VERSION_PARAM = self.version_param - config.INTERNAL_VERSION_EXTN = self.version_extn + config.APP_VERSION_PARAM = self.version_param + config.APP_VERSION_EXTN = self.version_extn - version_string = "?{0}={1}".format(config.INTERNAL_VERSION_PARAM, - config.APP_VERSION_INT) + version_string = "?{0}={1}".format(self.version_param, + self.app_version) + # create application app = create_app() with app.app_context(), app.test_request_context(): url = url_for(self.endpoint, filename=self.filename) diff --git a/web/pgadmin/browser/tests/test_login.py b/web/pgadmin/browser/tests/test_login.py index d830dfbca..d92c54a5e 100644 --- a/web/pgadmin/browser/tests/test_login.py +++ b/web/pgadmin/browser/tests/test_login.py @@ -86,6 +86,10 @@ class LoginTestCase(BaseTestGenerator): """ utils.logout_tester_account(cls.tester) + # No need to call base class setup function + def setUp(self): + pass + def runTest(self): """This function checks login functionality.""" response = self.tester.post( diff --git a/web/pgadmin/browser/tests/test_logout.py b/web/pgadmin/browser/tests/test_logout.py index 51c206f45..931375cd2 100644 --- a/web/pgadmin/browser/tests/test_logout.py +++ b/web/pgadmin/browser/tests/test_logout.py @@ -28,6 +28,10 @@ class LogoutTest(BaseTestGenerator): def setUpClass(cls): pass + # No need to call base class setup function + def setUp(self): + pass + def runTest(self): """This function checks the logout functionality.""" diff --git a/web/pgadmin/browser/tests/test_reset_password.py b/web/pgadmin/browser/tests/test_reset_password.py index 7bad400a3..5336d2cc2 100644 --- a/web/pgadmin/browser/tests/test_reset_password.py +++ b/web/pgadmin/browser/tests/test_reset_password.py @@ -42,6 +42,10 @@ class ResetPasswordTestCase(BaseTestGenerator): def setUpClass(cls): logout_tester_account(cls.tester) + # No need to call baseclass setup function + def setUp(self): + pass + def runTest(self): """This function checks reset password functionality.""" diff --git a/web/pgadmin/browser/tests/test_version_in_range.py b/web/pgadmin/browser/tests/test_version_in_range.py index 4d9ca76d8..f373abafd 100644 --- a/web/pgadmin/browser/tests/test_version_in_range.py +++ b/web/pgadmin/browser/tests/test_version_in_range.py @@ -57,6 +57,10 @@ class VersionInRangeTestCase(BaseTestGenerator): def setUpClass(cls): pass + # No need to call base class setup function + def setUp(self): + pass + def runTest(self): """This function will check version in range functionality.""" if self.scenario == 1: