Skip to content

Commit

Permalink
remove deprecated methods
Browse files Browse the repository at this point in the history
Signed-off-by: Olamide Ojo <[email protected]>
  • Loading branch information
olamidepeterojo committed Oct 23, 2024
1 parent 5408903 commit 016670e
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 30 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,7 @@ All notable changes to the Zowe Client Python SDK will be documented in this fil
- Fixed profile merge order to match Node.js SDK [#190](https://github.com/zowe/zowe-client-python-sdk/issues/190)
- Fixed issue for datasets and jobs with special characters in URL [#211](https://github.com/zowe/zowe-client-python-sdk/issues/211)
- Fixed exception handling in session.py [#213](https://github.com/zowe/zowe-client-python-sdk/issues/213)

### Bug Fixes
- Updated the sample scripts in readmes to remove/ stop using methods that were deprecated in #276
- Therefore this fixes #336
60 changes: 30 additions & 30 deletions tests/integration/test_zos_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_list_dsn_should_return_a_list_of_datasets(self):

for scenario in scenarios:
# Get the command output
command_output = self.files.list_dsn(self.files_fixtures["TEST_HLQ"], scenario["attributes"])
command_output = self.files.ds.list(self.files_fixtures["TEST_HLQ"], scenario["attributes"])

# Assert that command_output['items'] is a list
self.assertIsInstance(command_output, DatasetListResponse)
Expand All @@ -65,38 +65,38 @@ def test_list_dsn_should_return_a_list_of_datasets(self):
self.assertIn(expected_attr, attributes)

def test_list_members_should_return_a_list_of_members(self):
"""Executing list_dsn_members should return a list of members."""
command_output = self.files.list_dsn_members(self.files_fixtures["TEST_PDS"])
"""Executing list_members should return a list of members."""
command_output = self.files.ds.list_members(self.files_fixtures["TEST_PDS"])
self.assertIsInstance(command_output, MemberListResponse)

def test_get_dsn_content_should_return_content_from_dataset(self):
"""Executing get_dsn_content should return content from dataset."""
command_output = self.files.get_dsn_content(self.test_member_jcl)
def test_get_content_should_return_content_from_dataset(self):
"""Executing gget_content should return content from dataset."""
command_output = self.files.ds.get_content(self.test_member_jcl)
self.assertIsInstance(command_output, str)

def test_get_dsn_content_streamed_should_return_response_content(self):
"""Executing get_dsn_content_streamed should return response object from the server."""
command_output = self.files.get_dsn_content_streamed(self.test_member_jcl)
def test_get_content_should_return_response_content(self):
"""Executing get_content should return response object from the server."""
command_output = self.files.ds.get_content(self.test_member_jcl)
self.assertIsInstance(command_output.raw, urllib3.response.HTTPResponse)

def test_get_dsn_binary_content_streamed_should_return_response_content(self):
"""Executing get_dsn_binary_content_streamed should return response object from the server."""
command_output = self.files.get_dsn_binary_content_streamed(self.test_member_jcl)
def test_get_binary_content_should_return_response_content(self):
"""Executing get_binary_content should return response object from the server."""
command_output = self.files.ds.get_binary_content(self.test_member_jcl)
self.assertIsInstance(command_output.raw, urllib3.response.HTTPResponse)

def test_get_file_content_streamed_should_return_response_content(self):
"""Executing get_dsn_binary_content_streamed should return response object from the server."""
command_output = self.files.get_file_content_streamed(self.files_fixtures["TEST_USS"])
"""Executing get_binary_content should return response object from the server."""
command_output = self.files.uss.get_content_streamed(self.files_fixtures["TEST_USS"])
self.assertIsInstance(command_output.raw, urllib3.response.HTTPResponse)

def test_write_to_dsn_should_be_possible(self):
"""Executing write_to_dsn should be possible."""
command_output = self.files.write_to_dsn(self.test_member_generic, "HELLO WORLD")
def test_write_should_be_possible(self):
"""Executing write should be possible."""
command_output = self.files.ds.write(self.test_member_generic, "HELLO WORLD")
self.assertTrue(command_output == None)

def test_copy_uss_to_data_set_should_be_possible(self):
"""Executing copy_uss_to_data_set should be possible."""
command_output = self.files.copy_uss_to_data_set(
command_output = self.files.ds.copy_uss_to_data_set(
self.files_fixtures["TEST_USS"], self.files_fixtures["TEST_PDS"] + "(TEST2)", replace=True
)
self.assertTrue(command_output == None)
Expand All @@ -110,7 +110,7 @@ def test_copy_data_set_or_member_should_be_possible(self):
"to_member_name": "TEST",
"replace": True,
}
command_output = self.files.copy_data_set_or_member(**test_case)
command_output = self.files.ds.copy_data_set_or_member(**test_case)
self.assertTrue(command_output == None)

def test_mount_unmount_zfs_file_system(self):
Expand All @@ -119,47 +119,47 @@ def test_mount_unmount_zfs_file_system(self):
mount_point = self.files_fixtures["TEST_USS_MOUNT"]

# Create a zfs file system
zfs_file_system = self.files.create_zfs_file_system(self.test2_zfs_file_system, self.create_zfs_options)
zfs_file_system = self.files.fs.create(self.test2_zfs_file_system, self.create_zfs_options)

# Mount file system
command_output = self.files.mount_file_system(
command_output = self.files.fs.mount(
self.test2_zfs_file_system, mount_point, self.mount_zfs_file_system_options
)
self.assertTrue(command_output == None)

# List a zfs file system
command_output = self.files.list_unix_file_systems(file_system_name=self.test2_zfs_file_system.upper())
command_output = self.files.fs.list(file_system_name=self.test2_zfs_file_system.upper())
self.assertTrue(len(command_output["items"]) > 0)

# Unmount file system
command_output = self.files.unmount_file_system(self.test2_zfs_file_system)
command_output = self.files.fs.unmount(self.test2_zfs_file_system)
self.assertTrue(command_output == None)

# Delete file system
command_output = self.files.delete_zfs_file_system(self.test2_zfs_file_system)
command_output = self.files.fs.delete(self.test2_zfs_file_system)
self.assertTrue(command_output == None)

def test_upload_download_delete_dataset(self):
self.files.upload_file_to_dsn(SAMPLE_JCL_FIXTURE_PATH, self.test_ds_upload)
self.files.download_dsn(self.test_ds_upload, SAMPLE_JCL_FIXTURE_PATH + ".tmp")
self.files.ds.upload_file(SAMPLE_JCL_FIXTURE_PATH, self.test_ds_upload)
self.files.ds.download(self.test_ds_upload, SAMPLE_JCL_FIXTURE_PATH + ".tmp")

with open(SAMPLE_JCL_FIXTURE_PATH, "r") as in_file:
old_file_content = in_file.read()
with open(SAMPLE_JCL_FIXTURE_PATH + ".tmp", "r") as in_file:
new_file_content = in_file.read().rstrip()
self.assertEqual(old_file_content, new_file_content)

self.files.delete_data_set(self.files_fixtures["TEST_PDS"], member_name=self.files_fixtures["TEST_MEMBER_NEW"])
self.Dataset.delete(self.files_fixtures["TEST_PDS"], member_name=self.files_fixtures["TEST_MEMBER_NEW"])
os.unlink(SAMPLE_JCL_FIXTURE_PATH + ".tmp")

def test_upload_download_delete_uss(self):
self.files.upload_file_to_uss(SAMPLE_JCL_FIXTURE_PATH, self.test_uss_upload)
self.files.download_uss(self.test_uss_upload, SAMPLE_JCL_FIXTURE_PATH + ".tmp")
self.USSFiles.upload(SAMPLE_JCL_FIXTURE_PATH, self.test_uss_upload)
self.files.uss.download(self.test_uss_upload, SAMPLE_JCL_FIXTURE_PATH + ".tmp")
with open(SAMPLE_JCL_FIXTURE_PATH, "r") as in_file:
old_file_content = in_file.read()
with open(SAMPLE_JCL_FIXTURE_PATH + ".tmp", "r") as in_file:
new_file_content = in_file.read()
self.assertEqual(old_file_content, new_file_content)

self.files.delete_uss(self.test_uss_upload)
self.files.uss.delete(self.test_uss_upload)
os.unlink(SAMPLE_JCL_FIXTURE_PATH + ".tmp")

0 comments on commit 016670e

Please sign in to comment.