Skip to content

Commit

Permalink
Merge pull request #241 from dlcblade/#240_create_data_set_accept_FBA…
Browse files Browse the repository at this point in the history
…,FBM,VBA,VBM

#240 create data set accept fba,fbm,vba,vbm
  • Loading branch information
traeok authored Dec 11, 2023
2 parents 9cc18d9 + d7c9102 commit 8c9580a
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/zos_files/zowe/zos_files_for_zowe_sdk/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
33 changes: 33 additions & 0 deletions tests/unit/test_zos_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"""
Expand Down

0 comments on commit 8c9580a

Please sign in to comment.