mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Fix RESQL/MSQL test cases for Python 2.7
This commit is contained in:
parent
e64d6edc73
commit
f881542834
@ -9,7 +9,6 @@
|
||||
from __future__ import print_function
|
||||
import json
|
||||
import os
|
||||
import urllib
|
||||
import traceback
|
||||
from flask import url_for
|
||||
import regression
|
||||
@ -21,6 +20,17 @@ from pgadmin.browser.server_groups.servers.databases.tests import \
|
||||
from pgadmin.utils.versioned_template_loader import \
|
||||
get_version_mapping_directories
|
||||
|
||||
# import urlencode from urlib for python2.x and python3.x
|
||||
try:
|
||||
from urllib import urlencode
|
||||
except Exception as e:
|
||||
from urllib.parse import urlencode
|
||||
|
||||
try:
|
||||
basestring
|
||||
except NameError:
|
||||
basestring = str
|
||||
|
||||
|
||||
def create_resql_module_list(all_modules, exclude_pkgs, for_modules):
|
||||
"""
|
||||
@ -363,7 +373,7 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator):
|
||||
if isinstance(val, dict) or isinstance(val, list) else val
|
||||
for key, val in scenario['data'].items()}
|
||||
|
||||
params = urllib.parse.urlencode(msql_data)
|
||||
params = urlencode(msql_data)
|
||||
params = params.replace('False', 'false').replace('True', 'true')
|
||||
url = msql_url + "?%s" % params
|
||||
response = self.tester.get(url,
|
||||
@ -636,7 +646,8 @@ class ReverseEngineeredSQLTestCases(BaseTestGenerator):
|
||||
:param value:
|
||||
:return:
|
||||
"""
|
||||
if isinstance(value, str) and \
|
||||
|
||||
if isinstance(value, basestring) and \
|
||||
value.startswith('<') and value.endswith('>'):
|
||||
# Remove < and > from the string
|
||||
temp_value = value[1:-1]
|
||||
|
Loading…
Reference in New Issue
Block a user