Skip to content

Commit

Permalink
Merge pull request #1 from DivergentEuropeans/bugfix/mock
Browse files Browse the repository at this point in the history
Fix datasetContents giving Python error for some DS + GET method doesn't exist for VSAMdatasetContents
  • Loading branch information
timgerstel authored Aug 31, 2021
2 parents c24340a + b1257ee commit cd531ec
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions mock/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

global_username = "mock"
global_password = "pass"
global_password_expired = True
global_password_expired = False

global_datasets = [
{
Expand Down Expand Up @@ -376,8 +376,11 @@ def dataset_contents(dataset):
"records": x.get('records', []) for x in global_datasets if x['name'] == dataset
}
if dataset == data['name']:
if data['volser'] == "MIGRAT":
data['volser'] = genVolserId()
try:
if data['volser'] == "MIGRAT":
data['volser'] = genVolserId()
except KeyError:
break
if data['name'] == "MOCK.ETAG":
resp_data['etag'] = data['etag']
resp = make_response(resp_data)
Expand Down Expand Up @@ -416,14 +419,17 @@ def dataset_contents(dataset):
global_datasets = [x for x in global_datasets if x['name'] != dataset]
return {"msg": "Data set " + dataset + " was deleted successfully"}

@app.route('/VSAMdatasetContents/<path:dataset>', methods=['DELETE', 'POST'])
@app.route('/VSAMdatasetContents/<path:dataset>', methods=['GET', 'DELETE', 'POST'])
def VSAMdataset_contents(dataset):
global global_datasets
if request.method == 'GET':
for data in global_datasets:
if dataset == data['name']:
if data['volser'] == "MIGRAT":
data['volser'] = genVolserId()
try:
if data['volser'] == "MIGRAT":
data['volser'] = genVolserId()
except KeyError:
break
return {
"records": x.get('records', []) for x in global_datasets if x['name'] == dataset
}
Expand Down

0 comments on commit cd531ec

Please sign in to comment.