Beispiel #1
0
def test_check_status_user_error():
    check_status(200, mock_resp(200, None))  # no exception
    cid = "1234"
    with pytest.raises(NotFoundError) as e:
        check_status(200, mock_resp(404, {"errors": "not found"}), contact="contact", id=cid)
    msg = e.value.message.lower()
    # context and error information in error message
    assert "contact" in msg
    assert cid in msg
Beispiel #2
0
def test_unexpected_error():
    for code in (400, 503):
        with pytest.raises(UnknownError):
            check_status(200, mock_resp(code, None), contact="contact")