Ejemplo n.º 1
0
def test_send_report(mock_session):
    """Assert that a POST request is made when a report is sent"""
    send_report({'foo': 'bar'}, set_config())

    mock_session.post.assert_called_once_with(
        'https://metrics-api.iopipe.com/v0/event',
        json={'foo': 'bar'},
        timeout=5)
Ejemplo n.º 2
0
def test_send_report_network_timeout(mock_session):
    """Assert that the timeout is changed when network_timeout is set"""
    send_report({'foo': 'bar'}, set_config(network_timeout=60000))

    mock_session.post.assert_called_once_with(
        'https://metrics-api.iopipe.com/v0/event',
        json={'foo': 'bar'},
        timeout=60)
Ejemplo n.º 3
0
def test_send_report(mock_session):
    """Assert that a POST request is made when a report is sent"""
    send_report({"foo": "bar"}, set_config())

    mock_session.post.assert_called_once_with(
        "https://metrics-api.iopipe.com/v0/event",
        json={"foo": "bar"},
        headers=mock.ANY,
        timeout=5.0,
    )
Ejemplo n.º 4
0
def test_send_report_network_timeout(mock_session):
    """Assert that the timeout is changed when network_timeout is set"""
    send_report({"foo": "bar"}, set_config(network_timeout=60000))

    mock_session.post.assert_called_once_with(
        "https://metrics-api.iopipe.com/v0/event",
        json={"foo": "bar"},
        headers=mock.ANY,
        timeout=60,
    )