forked from zowe/zowe-client-python-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zoweGH-211 Unit tests update, changed adjustment to use urllib.parse.…
…quote Signed-off-by: Uladzislau <[email protected]>
- Loading branch information
Showing
2 changed files
with
22 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,21 @@ def test_object_should_be_instance_of_class(self): | |
files = Files(self.test_profile) | ||
self.assertIsInstance(files, Files) | ||
|
||
|
||
def test_adjust_for_url(self): | ||
"""Test dataset name is being adjusted to the correct URL parameter""" | ||
|
||
files = Files(self.test_profile) | ||
|
||
actual_not_empty = files._Files__adjust_for_url('[email protected]#.$HERE') | ||
expected_not_empty = 'MY.DSN%40.TEST%23.%24HERE' | ||
self.assertEqual(actual_not_empty, expected_not_empty) | ||
|
||
actual_none = files._Files__adjust_for_url(None) | ||
expected_none = None | ||
self.assertEqual(actual_none, expected_none) | ||
|
||
|
||
@mock.patch('requests.Session.send') | ||
def test_delete_uss(self, mock_send_request): | ||
"""Test deleting a directory recursively sends a request""" | ||
|
@@ -74,7 +89,7 @@ def test_unmount_zFS_file_system(self, mock_send_request): | |
|
||
@mock.patch('requests.Session.send') | ||
def test_list_dsn(self, mock_send_request): | ||
"""Test creating a zfs sends a request""" | ||
"""Test list DSN sends request""" | ||
mock_send_request.return_value = mock.Mock(headers={"Content-Type": "application/json"}, status_code=200) | ||
|
||
test_values = [ | ||
|
@@ -337,8 +352,9 @@ def test_rename_dataset_member_parametrized(self): | |
files_test_profile.rename_dataset_member(*test_case[0]) | ||
custom_args = files_test_profile._create_custom_request_arguments() | ||
custom_args["json"] = data | ||
custom_args["url"] = "https://mock-url.com:443/zosmf/restfiles/ds/{}({})".format( | ||
test_case[0][0], test_case[0][2]) | ||
ds_path = "{}({})".format(test_case[0][0], test_case[0][2]) | ||
ds_path_adjusted = files_test_profile._Files__adjust_for_url(ds_path) | ||
custom_args["url"] = "https://mock-url.com:443/zosmf/restfiles/ds/{}".format(ds_path_adjusted) | ||
files_test_profile.request_handler.perform_request.assert_called_once_with("PUT", custom_args, | ||
expected_code=[200]) | ||
else: | ||
|