def test_escalate_alert_without_args(): """ Given: - An app client object When: - Calling function escalate_alert with no arguments Then: - Ensure the resulted will raise an exception. """ mock_client = OpsGenieV3.Client(base_url="") with pytest.raises(DemistoException): OpsGenieV3.escalate_alert(mock_client, {})
def test_escalate_alert(mocker): """ Given: - An app client object - Alert-id = 1234 = escalation_id = 123 When: - Calling function escalate_alert Then: - Ensure the return data is correct """ mock_client = OpsGenieV3.Client(base_url="") mocker.patch.object(mock_client, 'escalate_alert', return_value=util_load_json('test_data/request.json')) mocker.patch.object(mock_client, 'get_request', return_value=util_load_json( 'test_data/escalate_alert.json', True)) res = OpsGenieV3.escalate_alert(mock_client, { "alert-id": 1234, "escalation_id": 123 }) assert ( res.raw_response == util_load_json('test_data/escalate_alert.json'))