예제 #1
0
def test_get_on_call_without_args():
    """
    Given:
        - An app client object
    When:
        - Calling function get_on_call with no arguments
    Then:
        - Ensure the resulted will raise an exception.
    """
    mock_client = OpsGenieV3.Client(base_url="")
    with pytest.raises(DemistoException):
        OpsGenieV3.get_on_call(mock_client, {})
예제 #2
0
def test_get_on_call(mocker):
    """
    Given:
        - An app client object
        - schedule_id = 1234
    When:
        - Calling function get_on_call
    Then:
        - Ensure the return data is correct
    """
    mock_client = OpsGenieV3.Client(base_url="")
    mocker.patch.object(
        mock_client,
        'get_on_call',
        return_value=util_load_json('test_data/delete_incident.json'))
    res = OpsGenieV3.get_on_call(mock_client, {"schedule_id": 1234})
    assert (
        res.raw_response == util_load_json('test_data/delete_incident.json'))