Ejemplo n.º 1
0
def test_add_responder_alert_wrong_responders():
    """
    Given:
        - An app client object
    When:
        - Calling function add_responder_alert 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_alert(mock_client,
                                       {'responders': ['team', 'id']})
Ejemplo n.º 2
0
def test_add_responder_alert(mocker):
    """
    Given:
        - An app client object
        - Alert-id = 1234
        - owner_id = 123
    When:
        - Calling function add_responder_alert
    Then:
        - Ensure the return data is correct
    """
    mock_client = OpsGenieV3.Client(base_url="")
    mocker.patch.object(mock_client,
                        'add_responder_alert',
                        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_alert.json', True))
    res = OpsGenieV3.add_responder_alert(mock_client, {
        "alert-id": 1234,
        "owner_id": 123
    })
    assert (res.raw_response == util_load_json(
        'test_data/add_responder_alert.json'))