-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Uladzislau <[email protected]>
- Loading branch information
Showing
6 changed files
with
59 additions
and
58 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
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,21 +20,6 @@ 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""" | ||
|
@@ -326,10 +311,10 @@ def test_rename_dataset_member_raises_exception(self): | |
def test_rename_dataset_member_parametrized(self): | ||
"""Test renaming a dataset member with different values""" | ||
test_values = [ | ||
(('DSN', "MBROLD", "MBRNEW", "EXCLU"), True), | ||
(('DSN', "MBROLD", "MBRNEW", "SHRW"), True), | ||
(('DSN', "MBROLD$", "MBRNEW", "EXCLU"), True), | ||
(('DSN', "MBROLD#", "MBRNEW", "SHRW"), True), | ||
(('DSN', "MBROLD", "MBRNEW", "INVALID"), False), | ||
(('DATA.SET.NAME', 'MEMBEROLD', 'MEMBERNEW'), True), | ||
(('DATA.SET.@NAME', 'MEMBEROLD', 'MEMBERNEW'), True), | ||
(('DS.NAME', "MONAME", "MNNAME"), True), | ||
] | ||
|
||
|
@@ -353,7 +338,8 @@ def test_rename_dataset_member_parametrized(self): | |
custom_args = files_test_profile._create_custom_request_arguments() | ||
custom_args["json"] = data | ||
ds_path = "{}({})".format(test_case[0][0], test_case[0][2]) | ||
ds_path_adjusted = files_test_profile._Files__adjust_for_url(ds_path) | ||
ds_path_adjusted = files_test_profile._adjust_for_url(ds_path) | ||
self.assertNotRegex(ds_path_adjusted, r'[\$\@\#]') | ||
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]) | ||
|
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 |
---|---|---|
|
@@ -125,6 +125,19 @@ def test_should_handle_token_auth(self): | |
self.token_props["tokenType"] + "=" + self.token_props["tokenValue"], | ||
) | ||
|
||
def test_adjust_for_url(self): | ||
"""Test string is being adjusted to the correct URL parameter""" | ||
|
||
sdk_api = SdkApi(self.basic_props, self.default_url) | ||
|
||
actual_not_empty = sdk_api._adjust_for_url('[email protected]#.$HERE') | ||
expected_not_empty = 'MY.STRING%40.TEST%23.%24HERE' | ||
self.assertEqual(actual_not_empty, expected_not_empty) | ||
|
||
actual_none = sdk_api._adjust_for_url(None) | ||
expected_none = None | ||
self.assertEqual(actual_none, expected_none) | ||
|
||
|
||
class TestRequestHandlerClass(unittest.TestCase): | ||
"""RequestHandler class unit tests.""" | ||
|