Skip to content

Commit

Permalink
Fix failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Anton Nikulin committed Nov 12, 2019
1 parent 5c071bd commit a8c641d
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions test/unit/module_utils/test_upsert_functionality.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,8 @@ def request_handler(url_path=None, http_method=None, body_params=None, path_para
elif http_method == HTTPMethod.GET:
return {
ResponseParams.SUCCESS: True,
ResponseParams.RESPONSE: {'items': []}
ResponseParams.RESPONSE: {'items': []},
ResponseParams.STATUS_CODE: 200,
}
else:
assert False
Expand Down Expand Up @@ -404,7 +405,8 @@ def get_operation_spec(name):
connection_mock.get_operation_specs_by_model_name.return_value = operations
connection_mock.send_request.return_value = {
ResponseParams.SUCCESS: True,
ResponseParams.RESPONSE: {'items': []}
ResponseParams.RESPONSE: {'items': []},
ResponseParams.STATUS_CODE: 200,
}
params = {
'operation': 'upsertObject',
Expand Down Expand Up @@ -464,7 +466,8 @@ def request_handler(url_path=None, http_method=None, body_params=None, path_para
{'name': 'testObject', 'value': old_value, 'type': 'object', 'id': obj_id,
'version': version}
]
}
},
ResponseParams.STATUS_CODE: 200,
}
elif http_method == HTTPMethod.PUT:
assert url_path == url_with_id_templ
Expand Down Expand Up @@ -537,7 +540,8 @@ def request_handler(url_path=None, http_method=None, body_params=None, path_para
ResponseParams.SUCCESS: True,
ResponseParams.RESPONSE: {
'items': [expected_val]
}
},
ResponseParams.STATUS_CODE: 200,
}
else:
assert False
Expand Down Expand Up @@ -602,6 +606,7 @@ def request_handler(url_path=None, http_method=None, body_params=None, path_para
return {
ResponseParams.SUCCESS: True,
ResponseParams.RESPONSE: expected_val,
ResponseParams.STATUS_CODE: 200,
}
elif http_method == HTTPMethod.GET:
assert url_path == url
Expand All @@ -615,6 +620,7 @@ def request_handler(url_path=None, http_method=None, body_params=None, path_para
ResponseParams.RESPONSE: {
'items': [expected_val]
},
ResponseParams.STATUS_CODE: 200,
}
else:
assert False
Expand Down Expand Up @@ -698,7 +704,8 @@ def request_handler(url_path=None, http_method=None, body_params=None, path_para
ResponseParams.SUCCESS: True,
ResponseParams.RESPONSE: {
'items': []
}
},
ResponseParams.STATUS_CODE: 200,
}
else:
assert False
Expand Down Expand Up @@ -777,7 +784,8 @@ def request_handler(url_path=None, http_method=None, body_params=None, path_para
{'name': 'testObject', 'value': old_value, 'type': 'object', 'id': obj_id,
'version': version}
]
}
},
ResponseParams.STATUS_CODE: 200,
}
elif http_method == HTTPMethod.PUT:
assert url_path == url_with_id_templ
Expand Down Expand Up @@ -897,7 +905,8 @@ def request_handler(url_path=None, http_method=None, body_params=None, path_para
ResponseParams.SUCCESS: True,
ResponseParams.RESPONSE: {
'items': [sample_obj, sample_obj]
}
},
ResponseParams.STATUS_CODE: 200,
}
else:
assert False
Expand Down

0 comments on commit a8c641d

Please sign in to comment.