From f580bd64cf3806d193fdd42ed1eaa96c549cbde7 Mon Sep 17 00:00:00 2001 From: pem70 Date: Mon, 17 Jun 2024 09:07:45 -0400 Subject: [PATCH] Resolved comments Signed-off-by: pem70 --- CHANGELOG.md | 2 +- src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py | 13 +++++++++---- tests/unit/files/datasets/test_delete.py | 12 +++--------- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2db54991..69162e72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,11 +9,11 @@ All notable changes to the Zowe Client Python SDK will be documented in this fil - Added logger class to core SDK [#185](https://github.com/zowe/zowe-client-python-sdk/issues/185) - Added classes for handling `Datasets`, `USSFiles`, and `FileSystems` in favor of the single Files class. [#264](https://github.com/zowe/zowe-client-python-sdk/issues/264) - Refactored tests into proper folders and files [#265](https://github.com/zowe/zowe-client-python-sdk/issues/265) -- Fixed the bug on `upload_file_to_dsn` [#104](https://github.com/zowe/zowe-client-python-sdk/issues/104) ### Bug Fixes - Fixed truncated responses when issuing TSO commands [#260](https://github.com/zowe/zowe-client-python-sdk/issues/260) +- Fixed a bug on `upload_file_to_dsn` where it would not properly convert line endings on Windows. [#104](https://github.com/zowe/zowe-client-python-sdk/issues/104) ## `1.0.0-dev15` diff --git a/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py b/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py index 761230b5..91cdf772 100644 --- a/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py +++ b/src/zos_tso/zowe/zos_tso_for_zowe_sdk/tso.py @@ -11,6 +11,7 @@ """ import json + from zowe.core_for_zowe_sdk import SdkApi, constants @@ -61,10 +62,8 @@ def issue_command(self, command): command_output = self.send_tso_message(session_key, command) tso_messages = self.retrieve_tso_messages(command_output) while not any("TSO PROMPT" in message for message in command_output) or not tso_messages: - custom_args = self._create_custom_request_arguments() - custom_args["url"] = "{}/{}".format(self.request_endpoint, session_key) - command_output = self.request_handler.perform_request("GET", custom_args)["tsoData"] - tso_messages += self.retrieve_tso_messages(command_output) + command_output = self.__get_tso_data(session_key) + tso_messages += self.retrieve_tso_messages(command_output) self.end_tso_session(session_key) return tso_messages @@ -206,3 +205,9 @@ def retrieve_tso_messages(self, response_json): A list containing the TSO response messages """ return [message["TSO MESSAGE"]["DATA"] for message in response_json if "TSO MESSAGE" in message] + + def __get_tso_data(self, session_key): + custom_args = self._create_custom_request_arguments() + custom_args["url"] = "{}/{}".format(self.request_endpoint, session_key) + command_output = self.request_handler.perform_request("GET", custom_args)["tsoData"] + return command_output diff --git a/tests/unit/files/datasets/test_delete.py b/tests/unit/files/datasets/test_delete.py index 460879c4..4ce6c520 100644 --- a/tests/unit/files/datasets/test_delete.py +++ b/tests/unit/files/datasets/test_delete.py @@ -1,7 +1,7 @@ import re from unittest import TestCase, mock -from zowe.zos_files_for_zowe_sdk import Files, exceptions, Datasets +from zowe.zos_files_for_zowe_sdk import Datasets, Files, exceptions class TestDeleteClass(TestCase): @@ -26,18 +26,13 @@ def test_delete(self, mock_send_request): mock_send_request.assert_called_once() @mock.patch("requests.Session.send") - def test_delete_pram(self, mock_send_request): + def test_delete_param(self, mock_send_request): """Test list members sends request""" self.files_instance = Files(self.test_profile) mock_send_request.return_value = mock.Mock(headers={"Content-Type": "application/json"}, status_code=200) mock_send_request.return_value.json.return_value = {} - test_cases = [ - ("MY.PDS", 1000, "m1"), - ("MY.C", 100, "m2"), - ("MY.D", 1000, "member"), - ("MY.E", 500, "extended") - ] + test_cases = [("MY.PDS", 1000, "m1"), ("MY.C", 100, "m2"), ("MY.D", 1000, "member"), ("MY.E", 500, "extended")] for dataset_name, volume, member_name in test_cases: result = self.files_instance.delete_data_set(dataset_name, volume, member_name) @@ -45,4 +40,3 @@ def test_delete_pram(self, mock_send_request): mock_send_request.assert_called() prepared_request = mock_send_request.call_args[0][0] self.assertEqual(prepared_request.method, "DELETE") -