def test_add_responder_incident_wrong_args(): """ Given: - An app client object When: - Calling function add_responder_incident with argument responders in the wrong format Then: - Ensure the resulted will raise an exception. """ mock_client = OpsGenieV3.Client(base_url="") with pytest.raises(DemistoException): OpsGenieV3.add_responder_incident(mock_client, {'responders': ['team', 'id']})
def test_add_responder_incident(mocker): """ Given: - An app client object - incident_id = 1234 - responders = ["team", "id", "name"] When: - Calling function add_responder_incident Then: - Ensure the return data is correct """ mock_client = OpsGenieV3.Client(base_url="") mocker.patch.object(mock_client, 'add_responder_incident', return_value=util_load_json('test_data/request.json')) mocker.patch.object(mock_client, 'get_request', return_value=util_load_json( 'test_data/add_responder_incident.json', True)) res = OpsGenieV3.add_responder_incident( mock_client, { "incident_id": 1234, "responders": ["team", "id", "name"] }) assert (res.raw_response == util_load_json( 'test_data/add_responder_incident.json'))