Change the following to replace Python 2 code with Python 3:

1) Replace the deprecated unit test method.
2) Wraps filter usage in a list call.
3) Converts the old metaclass syntax to new.
4) Use range instead of xrange method.
5) Change Unicode to str.
6) Several other transformations.
7) Fixed change password test cases.
8) Use simplejson instead of plain JSON.
This commit is contained in:
Cyril Jouve
2020-08-31 16:45:31 +05:30
committed by Akshay Joshi
parent 11d5613866
commit 5a253f9053
385 changed files with 938 additions and 944 deletions

View File

@@ -168,7 +168,7 @@ def filename_with_file_manager_path(_file):
storage_dir = get_storage_directory()
if storage_dir:
_file = os.path.join(storage_dir, _file.lstrip(u'/').lstrip(u'\\'))
_file = os.path.join(storage_dir, _file.lstrip('/').lstrip('\\'))
elif not os.path.isabs(_file):
_file = os.path.join(document_dir(), _file)

View File

@@ -32,6 +32,6 @@ class TestUtilityCheckRouteCase(BaseTestGenerator):
does_utility_exist_mock.return_value = False
server_id = self.server_information['server_id']
response = self.tester.get(self.url.format(server_id))
self.assertEquals(response.status_code, 200)
self.assertEqual(response.status_code, 200)
response = json.loads(response.data.decode('utf-8'))
self.assertEquals(self.expected_success_value, response['success'])
self.assertEqual(self.expected_success_value, response['success'])

View File

@@ -115,7 +115,7 @@ class RestoreJobTest(BaseTestGenerator):
cnt = 0
the_process = None
while 1:
while True:
if cnt >= 5:
break
# Check the process list
@@ -165,7 +165,7 @@ class RestoreJobTest(BaseTestGenerator):
# Retrieve the restore job process logs
cnt = 0
while 1:
while True:
out, err, status = RestoreJobTest.get_params(p_details_data)
if status or cnt >= 5:
break