diff --git a/CHANGELOG.md b/CHANGELOG.md index abf4484a..541392bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to the Zowe Client Python SDK will be documented in this file. +## Recent Changes + +### Bug Fixes + +- Fixed 'create_data_set' to accept "FBA", "FBM", "VBA", "VBM" as valid recfm [#240](https://github.com/zowe/zowe-client-python-sdk/issues/240) + ## `1.0.0-dev12` ### Bug Fixes diff --git a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py index f338854a..fa817fdb 100644 --- a/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py +++ b/src/zos_files/zowe/zos_files_for_zowe_sdk/files.py @@ -331,7 +331,7 @@ def create_data_set(self, dataset_name, options={}): if options.get(opt) is None: options[opt] = "F" else: - if options[opt] not in ("F", "FB", "V", "VB", "U"): + if options[opt] not in ("F", "FB", "V", "VB", "U", "FBA", "FBM", "VBA", "VBM"): raise KeyError if opt == "blksize": diff --git a/tests/unit/test_zos_files.py b/tests/unit/test_zos_files.py index 927e80d5..acd3478f 100644 --- a/tests/unit/test_zos_files.py +++ b/tests/unit/test_zos_files.py @@ -356,6 +356,39 @@ def test_rename_dataset_member_parametrized(self): with self.assertRaises(ValueError) as e_info: files_test_profile.rename_dataset_member(*test_case[0]) self.assertEqual(str(e_info.exception), "Invalid value for enq.") + + @mock.patch("requests.Session.send") + def test_create_data_set_accept_valid_recfm(self, mock_send_request): + """Test if create dataset does accept all accepted record formats""" + mock_send_request.return_value = mock.Mock(headers={"Content-Type": "application/json"}, status_code=201) + for recfm in ["F", "FB", "V", "VB", "U", "FBA", "FBM", "VBA", "VBM"]: + Files(self.test_profile).create_data_set( + "DSNAME123", options={ + "alcunit": "CYL", + "dsorg": "PO", + "primary": 1, + "dirblk": 5, + "recfm": recfm, + "blksize": 6160, + "lrecl": 80 + } + ) + mock_send_request.assert_called() + + def test_create_data_set_does_not_accept_invalid_recfm(self): + """Test if create dataset raises an error for invalid record formats""" + with self.assertRaises(KeyError): + Files(self.test_profile).create_data_set( + "DSNAME123", options={ + "alcunit": "CYL", + "dsorg": "PO", + "primary": 1, + "dirblk": 5, + "recfm": "XX", + "blksize": 6160, + "lrecl": 80 + } + ) def test_create_data_set_raises_error_without_required_arguments(self): """Test not providing required arguments raises an error"""