Remove Python 2 support from the Python tests.

refs #5443
pull/33/head
Dave Page 2020-04-30 12:56:45 +05:30 committed by Akshay Joshi
parent 393741fd9d
commit 86afec860f
55 changed files with 76 additions and 353 deletions

View File

@ -14,12 +14,7 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as cast_utils
import sys
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class CastsCreateTestCase(BaseTestGenerator):

View File

@ -14,13 +14,7 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as cast_utils
import sys
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class CastsCreateGetFunctionsTestCase(BaseTestGenerator):

View File

@ -14,13 +14,7 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as cast_utils
import sys
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class CastsCreateGettypeTestCase(BaseTestGenerator):

View File

@ -15,13 +15,7 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as cast_utils
import sys
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class CastsDeleteTestCase(BaseTestGenerator):

View File

@ -8,7 +8,6 @@
##########################################################################
from __future__ import print_function
import json
from pgadmin.browser.server_groups.servers.databases.tests import \
utils as database_utils
@ -16,13 +15,7 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as cast_utils
import sys
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class CastsMultipleDeleteTestCase(BaseTestGenerator):

View File

@ -14,13 +14,7 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as cast_utils
import sys
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class CastsGetTestCase(BaseTestGenerator):

View File

@ -15,12 +15,6 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as cast_utils
import sys
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
class CastsGetDependentsAndDependencyTestCase(BaseTestGenerator):

View File

@ -1,3 +1,12 @@
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
from __future__ import print_function
from pgadmin.browser.server_groups.servers.databases.tests import \
utils as database_utils
@ -5,13 +14,7 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as cast_utils
import sys
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class CastsGetNodeTestCase(BaseTestGenerator):

View File

@ -15,12 +15,7 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as cast_utils
import sys
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class CastsGetSqlTestCase(BaseTestGenerator):

View File

@ -9,20 +9,13 @@
from __future__ import print_function
import json
from pgadmin.browser.server_groups.servers.databases.tests import \
utils as database_utils
from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as cast_utils
import sys
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class CastsPutTestCase(BaseTestGenerator):

View File

@ -9,8 +9,6 @@
import json
import uuid
import sys
from pgadmin.browser.server_groups.servers.databases.schemas.tests import \
utils as schema_utils
from pgadmin.browser.server_groups.servers.databases.tests import \
@ -21,11 +19,7 @@ from regression import parent_node_dict
from regression import trigger_funcs_utils
from regression.python_test_utils import test_utils as utils
from . import utils as event_trigger_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class EventTriggerAddTestCase(BaseTestGenerator):

View File

@ -8,8 +8,6 @@
##########################################################################
import uuid
import sys
from pgadmin.browser.server_groups.servers.databases.schemas.tests import \
utils as schema_utils
from pgadmin.browser.server_groups.servers.databases.tests import \
@ -20,11 +18,7 @@ from regression import parent_node_dict
from regression import trigger_funcs_utils
from regression.python_test_utils import test_utils as utils
from . import utils as event_trigger_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class EventTriggerDeleteTestCase(BaseTestGenerator):

View File

@ -8,7 +8,6 @@
##########################################################################
import uuid
import sys
from pgadmin.browser.server_groups.servers.databases.schemas.tests import \
utils as schema_utils
@ -20,11 +19,7 @@ from regression import parent_node_dict
from regression import trigger_funcs_utils
from regression.python_test_utils import test_utils as utils
from . import utils as event_trigger_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class EventTriggerFunctionsTestCase(BaseTestGenerator):

View File

@ -8,7 +8,6 @@
##########################################################################
import uuid
import sys
from pgadmin.browser.server_groups.servers.databases.schemas.tests import \
utils as schema_utils
from pgadmin.browser.server_groups.servers.databases.tests import \
@ -19,11 +18,7 @@ from regression import parent_node_dict
from regression import trigger_funcs_utils
from regression.python_test_utils import test_utils as utils
from . import utils as event_trigger_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class EventTriggerGetTestCase(BaseTestGenerator):

View File

@ -9,8 +9,6 @@
import json
import uuid
import sys
from pgadmin.browser.server_groups.servers.databases.schemas.tests import \
utils as schema_utils
from pgadmin.browser.server_groups.servers.databases.tests import \
@ -21,11 +19,7 @@ from regression import parent_node_dict
from regression import trigger_funcs_utils
from regression.python_test_utils import test_utils as utils
from . import utils as event_trigger_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class EventTriggerPutTestCase(BaseTestGenerator):

View File

@ -8,7 +8,6 @@
##########################################################################
import uuid
import sys
from pgadmin.browser.server_groups.servers.databases.schemas.tests import \
utils as schema_utils
from pgadmin.browser.server_groups.servers.databases.tests import \
@ -19,11 +18,7 @@ from regression import parent_node_dict
from regression import trigger_funcs_utils
from regression.python_test_utils import test_utils as utils
from . import utils as event_trigger_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class EventTriggerGetSqlTestCase(BaseTestGenerator):

View File

@ -7,18 +7,12 @@
#
##########################################################################
import sys
import six
from pgadmin.browser.server_groups.servers\
.databases.external_tables import ExternalTablesModule
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import MagicMock, Mock
else:
from unittest.mock import MagicMock, Mock
from unittest.mock import MagicMock, Mock
class TestExternalTablesModule(BaseTestGenerator):

View File

@ -8,16 +8,11 @@
##########################################################################
import os
import sys
from pgadmin.browser.server_groups.servers.databases.external_tables import \
ExternalTablesView
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import MagicMock, patch
else:
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock, patch
class TestExternalTablesView(BaseTestGenerator):

View File

@ -6,18 +6,13 @@
# This software is released under the PostgreSQL Licence
#
##########################################################################
import sys
from pgadmin.browser.server_groups.servers.databases \
.external_tables import Properties
from pgadmin.browser.server_groups.servers.databases.external_tables \
.properties import PropertiesException, PropertiesTableNotFoundException
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import MagicMock, patch
else:
from unittest.mock import MagicMock, patch
from unittest.mock import MagicMock, patch
class TestProperties(BaseTestGenerator):

View File

@ -7,17 +7,11 @@
#
##########################################################################
import sys
from pgadmin.browser.server_groups.servers.databases \
.external_tables.reverse_engineer_ddl import \
ReverseEngineerDDL, ReverseEngineerDDLException
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import MagicMock
else:
from unittest.mock import MagicMock
from unittest.mock import MagicMock
class TestReverseEngineerDDL(BaseTestGenerator):

View File

@ -11,7 +11,6 @@ from __future__ import print_function
import json
import uuid
import sys
from pgadmin.browser.server_groups.servers.databases.tests import \
utils as database_utils
@ -19,11 +18,7 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as language_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class LanguagesAddTestCase(BaseTestGenerator):

View File

@ -8,7 +8,6 @@
##########################################################################
from __future__ import print_function
import sys
import uuid
from pgadmin.browser.server_groups.servers.databases.tests import \
utils as database_utils
@ -16,11 +15,7 @@ from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as language_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class LanguagesDeleteTestCase(BaseTestGenerator):

View File

@ -10,18 +10,13 @@
from __future__ import print_function
import uuid
import sys
from pgadmin.browser.server_groups.servers.databases.tests import \
utils as database_utils
from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from regression.python_test_utils import test_utils as utils
from . import utils as language_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class LanguagesGetTestCase(BaseTestGenerator):

View File

@ -10,18 +10,13 @@
from __future__ import print_function
import uuid
import sys
from . import utils as language_utils
from regression.python_test_utils import test_utils as utils
from regression import parent_node_dict
from pgadmin.utils.route import BaseTestGenerator
from pgadmin.browser.server_groups.servers.databases.tests import \
utils as database_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class LanguagesGetFunctionAndTemplateTestCase(BaseTestGenerator):

View File

@ -11,18 +11,13 @@ from __future__ import print_function
import json
import uuid
import sys
from regression.python_test_utils import test_utils as utils
from pgadmin.utils.route import BaseTestGenerator
from pgadmin.browser.server_groups.servers.databases.tests import \
utils as database_utils
from regression import parent_node_dict
from . import utils as language_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class LanguagesPutTestCase(BaseTestGenerator):

View File

@ -10,18 +10,13 @@
from __future__ import print_function
import uuid
import sys
from pgadmin.utils.route import BaseTestGenerator
from regression import parent_node_dict
from . import utils as language_utils
from regression.python_test_utils import test_utils as utils
from pgadmin.browser.server_groups.servers.databases.tests import \
utils as database_utils
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class LanguagesGetSql(BaseTestGenerator):

View File

@ -7,16 +7,10 @@
#
##########################################################################
import sys
from pgadmin.browser.server_groups.servers.databases.schemas.tables.\
partitions import PartitionsModule
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import patch, Mock, call
else:
from unittest.mock import patch, Mock, call
from unittest.mock import patch, Mock, call
class TestBackendSupport(BaseTestGenerator):

View File

@ -8,8 +8,6 @@
##########################################################################
import os
import sys
from pgadmin.utils.driver import DriverRegistry
from regression.python_test_utils.template_helper import file_as_template
@ -17,9 +15,6 @@ DriverRegistry.load_drivers()
from pgadmin.utils.route import BaseTestGenerator
from regression.python_test_utils import test_utils
if sys.version_info[0] >= 3:
long = int
class TestColumnForeignKeyGetConstraintCols(BaseTestGenerator):
scenarios = [

View File

@ -8,15 +8,10 @@
##########################################################################
import os
import sys
from regression.python_test_utils.sql_template_test_base import \
SQLTemplateTestBase
from regression.python_test_utils.template_helper import file_as_template
if sys.version_info[0] >= 3:
long = int
class TestTablesNodeSql(SQLTemplateTestBase):
scenarios = [
@ -48,8 +43,8 @@ class TestTablesNodeSql(SQLTemplateTestBase):
triggercount = first_row['triggercount']
has_enable_triggers = first_row['has_enable_triggers']
self.assertIsNotNone(long(oid))
self.assertIsNotNone(int(oid))
self.assertEqual('test_table', name)
# triggercount is sometimes returned as a string for some reason
self.assertEqual(0, long(triggercount))
self.assertIsNotNone(long(has_enable_triggers))
self.assertEqual(0, int(triggercount))
self.assertIsNotNone(int(has_enable_triggers))

View File

@ -8,17 +8,11 @@
##########################################################################
import os
import sys
from regression.python_test_utils.template_helper import file_as_template
from regression.python_test_utils.sql_template_test_base import \
SQLTemplateTestBase
if sys.version_info[0] >= 3:
long = int
class TestTablesPropertiesSql(SQLTemplateTestBase):
scenarios = [
("This scenario tests that all applicable sql template versions can "
@ -39,7 +33,7 @@ class TestTablesPropertiesSql(SQLTemplateTestBase):
self.assertEqual('test_table', first_row['name'])
# triggercount is sometimes returned as a string for some reason
self.assertEqual(0, long(first_row['triggercount']))
self.assertEqual(0, int(first_row['triggercount']))
self.assertEqual(None, first_row['typname'])
self.assertEqual([], first_row['coll_inherits'])

View File

@ -6,15 +6,11 @@
# This software is released under the PostgreSQL Licence
#
##########################################################################
import sys
from pgadmin.browser.server_groups.servers.databases.schemas.tables import \
BaseTableView
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import patch, MagicMock
else:
from unittest.mock import patch, MagicMock
from unittest.mock import patch, MagicMock
class TestBaseView(BaseTableView):

View File

@ -7,16 +7,10 @@
#
##########################################################################
import sys
from pgadmin.browser.server_groups.servers.databases.schemas.utils import \
DataTypeReader
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import patch, Mock
else:
from unittest.mock import patch, Mock
from unittest.mock import patch, Mock
_default_database_response = [
{

View File

@ -6,13 +6,8 @@
# This software is released under the PostgreSQL Licence
#
##########################################################################
import sys
if sys.version_info < (3, 3):
from mock import MagicMock
else:
from unittest.mock import MagicMock
from unittest.mock import MagicMock
from pgadmin.browser.server_groups.servers.tablespaces import TablespaceModule
from pgadmin.utils.route import BaseTestGenerator

View File

@ -7,17 +7,12 @@
#
##########################################################################
import sys
import config as app_config
from pgadmin.utils.route import BaseTestGenerator
from regression.python_test_utils import test_utils as utils
from regression.test_setup import config_data
from pgadmin.authenticate.registry import AuthSourceRegistry
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class LDAPLoginMockTestCase(BaseTestGenerator):

View File

@ -7,8 +7,6 @@
#
##########################################################################
import sys
import simplejson as json
import os
@ -17,12 +15,7 @@ from regression import parent_node_dict
from pgadmin.utils import server_utils as server_utils, does_utility_exist
from pgadmin.browser.server_groups.servers.databases.tests import utils as \
database_utils
if sys.version_info < (3, 3):
from mock import patch, MagicMock
else:
from unittest.mock import patch, MagicMock
from unittest.mock import patch, MagicMock
class BackupCreateJobTest(BaseTestGenerator):

View File

@ -7,15 +7,9 @@
#
##########################################################################
import sys
from pgadmin.tools.backup import BackupMessage, BACKUP
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class BackupMessageTest(BaseTestGenerator):

View File

@ -7,18 +7,12 @@
#
##########################################################################
import sys
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc, \
current_app
from pgadmin.tools.backup import BackupMessage, BACKUP
from pgadmin.utils.route import BaseTestGenerator
from pickle import dumps, loads
if sys.version_info < (3, 3):
from mock import patch, MagicMock
else:
from unittest.mock import patch, MagicMock
from unittest.mock import patch, MagicMock
class BatchProcessTest(BaseTestGenerator):

View File

@ -7,16 +7,12 @@
#
##########################################################################
import sys
import json
from pgadmin.utils.route import BaseTestGenerator
from regression.python_test_utils.test_utils import\
check_binary_path_or_skip_test
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class TestUtilityCheckRouteCase(BaseTestGenerator):

View File

@ -7,16 +7,11 @@
#
##########################################################################
import sys
import json
from pgadmin.utils.route import BaseTestGenerator
from regression.python_test_utils.test_utils import\
check_binary_path_or_skip_test
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class TestUtilityCheckRouteCase(BaseTestGenerator):

View File

@ -7,18 +7,12 @@
#
##########################################################################
import sys
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc, \
current_app
from pgadmin.tools.maintenance import Message
from pgadmin.utils.route import BaseTestGenerator
from pickle import dumps, loads
if sys.version_info < (3, 3):
from mock import patch, MagicMock
else:
from unittest.mock import patch, MagicMock
from unittest.mock import patch, MagicMock
class BatchProcessTest(BaseTestGenerator):

View File

@ -7,16 +7,11 @@
#
##########################################################################
import sys
import json
from pgadmin.utils.route import BaseTestGenerator
from regression.python_test_utils.test_utils import\
check_binary_path_or_skip_test
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class TestUtilityCheckRouteCase(BaseTestGenerator):

View File

@ -7,7 +7,6 @@
#
##########################################################################
import sys
import os
import simplejson as json
@ -16,11 +15,7 @@ from regression import parent_node_dict
from pgadmin.utils import server_utils as server_utils, does_utility_exist
from pgadmin.browser.server_groups.servers.databases.tests import utils as \
database_utils
if sys.version_info < (3, 3):
from mock import patch, MagicMock
else:
from unittest.mock import patch, MagicMock
from unittest.mock import patch, MagicMock
class MaintenanceCreateJobTest(BaseTestGenerator):

View File

@ -7,18 +7,12 @@
#
##########################################################################
import sys
from pgadmin.misc.bgprocess.processes import BatchProcess, IProcessDesc, \
current_app
from pgadmin.tools.restore import RestoreMessage
from pgadmin.utils.route import BaseTestGenerator
from pickle import dumps, loads
if sys.version_info < (3, 3):
from mock import patch, MagicMock
else:
from unittest.mock import patch, MagicMock
from unittest.mock import patch, MagicMock
class BatchProcessTest(BaseTestGenerator):

View File

@ -7,16 +7,11 @@
#
##########################################################################
import sys
import json
from pgadmin.utils.route import BaseTestGenerator
from regression.python_test_utils.test_utils import\
check_binary_path_or_skip_test
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class TestUtilityCheckRouteCase(BaseTestGenerator):

View File

@ -7,7 +7,6 @@
#
##########################################################################
import sys
import simplejson as json
import os
@ -16,11 +15,7 @@ from regression import parent_node_dict
from pgadmin.utils import server_utils as server_utils, does_utility_exist
from pgadmin.browser.server_groups.servers.databases.tests import utils as \
database_utils
if sys.version_info < (3, 3):
from mock import patch, MagicMock
else:
from unittest.mock import patch, MagicMock
from unittest.mock import patch, MagicMock
class RestoreCreateJobTest(BaseTestGenerator):
@ -233,7 +228,7 @@ class RestoreCreateJobTest(BaseTestGenerator):
not_expected_cmd_opts=[],
expected_exit_code=[0, None]
)),
('When restore object with option - Disbale',
('When restore object with option - Disable Triggers',
dict(
class_params=dict(
sid=1,

View File

@ -7,15 +7,9 @@
#
##########################################################################
import sys
from pgadmin.tools.restore import RestoreMessage
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class RestoreMessageTest(BaseTestGenerator):

View File

@ -1,12 +1,15 @@
import sys
##########################################################################
#
# pgAdmin 4 - PostgreSQL Tools
#
# Copyright (C) 2013 - 2020, The pgAdmin Development Team
# This software is released under the PostgreSQL Licence
#
##########################################################################
from pgadmin.tools.search_objects.utils import SearchObjectsHelper, current_app
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import patch, MagicMock
else:
from unittest.mock import patch, MagicMock
from unittest.mock import patch, MagicMock
class SearchObjectsHelperTest(BaseTestGenerator):

View File

@ -12,10 +12,9 @@ from unittest.mock import patch
from pgadmin.utils.route import BaseTestGenerator
from pgadmin.browser.server_groups.servers.databases.tests import utils as \
database_utils
from regression import parent_node_dict
from regression.python_test_utils import test_utils
import json
from pgadmin.utils import server_utils, IS_PY2
from pgadmin.utils import server_utils
import random

View File

@ -13,7 +13,7 @@ from pgadmin.browser.server_groups.servers.databases.tests import utils as \
database_utils
from regression.python_test_utils import test_utils
import json
from pgadmin.utils import server_utils, IS_PY2
from pgadmin.utils import server_utils
import random
@ -273,10 +273,7 @@ class TestEncodingCharset(BaseTestGenerator):
self.assertEquals(response.status_code, 200)
response_data = json.loads(response.data.decode('utf-8'))
self.assertEquals(response_data['data']['rows_fetched_to'], 1)
if IS_PY2 and type(response_data['data']['result'][0][0]) == unicode:
result = response_data['data']['result'][0][0].encode('utf-8')
else:
result = response_data['data']['result'][0][0]
result = response_data['data']['result'][0][0]
self.assertEquals(result, self.test_str)
database_utils.disconnect_database(self, self.encode_sid,

View File

@ -104,11 +104,7 @@ class TestSQLASCIIEncoding(BaseTestGenerator):
pg_cursor.execute(query)
resp = pg_cursor.fetchone()
if sys.version_info < (3,):
self.assertEqual(resp[0].encode("raw_unicode_escape"),
self.test_str)
else:
self.assertEqual(resp[0], self.test_str)
self.assertEqual(resp[0], self.test_str)
def tearDown(self):
main_conn = test_utils.get_db_connection(

View File

@ -6,15 +6,10 @@
# This software is released under the PostgreSQL Licence
#
##########################################################################
import sys
from pgadmin.utils.route import BaseTestGenerator
from pgadmin.tools.sqleditor import StartRunningQuery
if sys.version_info < (3, 3):
from mock import patch, ANY
else:
from unittest.mock import patch, ANY
from unittest.mock import patch, ANY
class StartQueryTool(BaseTestGenerator):

View File

@ -10,19 +10,12 @@
import uuid
import json
import random
import sys
from pgadmin.utils.route import BaseTestGenerator
from pgadmin.browser.server_groups.servers.databases.tests import utils as \
database_utils
from regression import parent_node_dict
from regression.python_test_utils import test_utils
from pgadmin.utils import server_utils, IS_PY2
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class TestViewData(BaseTestGenerator):

View File

@ -8,15 +8,10 @@
##########################################################################
"""Apply Explain plan wrapper to sql object."""
import sys
from pgadmin.tools.sqleditor.utils import apply_explain_plan_wrapper_if_needed
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import patch, MagicMock
else:
from unittest.mock import patch, MagicMock
from unittest.mock import patch, MagicMock
class StartRunningQueryTest(BaseTestGenerator):

View File

@ -6,7 +6,6 @@
# This software is released under the PostgreSQL Licence
#
##########################################################################
import sys
from flask import Response
import simplejson as json
@ -14,11 +13,7 @@ import simplejson as json
from pgadmin.tools.sqleditor.utils.start_running_query import StartRunningQuery
from pgadmin.utils.exception import ConnectionLost, SSHTunnelConnectionLost
from pgadmin.utils.route import BaseTestGenerator
if sys.version_info < (3, 3):
from mock import patch, MagicMock
else:
from unittest.mock import patch, MagicMock
from unittest.mock import patch, MagicMock
get_driver_exception = Exception('get_driver exception')
get_connection_lost_exception = Exception('Unable to connect to server')

View File

@ -7,16 +7,10 @@
#
##########################################################################
import sys
from pgadmin.utils.route import BaseTestGenerator
from pgadmin.utils.javascript.javascript_bundler import JavascriptBundler
from pgadmin.utils.javascript.javascript_bundler import JsState
if sys.version_info < (3, 3):
from mock import patch
else:
from unittest.mock import patch
from unittest.mock import patch
class JavascriptBundlerTestCase(BaseTestGenerator):