Ejemplo n.º 1
0
def test_network_400(api, resp_bad):
    """Should get a NassException without explicit error message"""
    with pytest.raises(exceptions.NassException):
        api._handle_response_data({}, resp_bad, '')
Ejemplo n.º 2
0
def test_generic_error(api, resp_bad):
    with pytest.raises(exceptions.ApiException) as exc:
        api._handle_response_data({'error': ['blah']}, resp_bad, '')
    assert 'Server returned error message ' in str(exc)
Ejemplo n.º 3
0
def test_exception_list(api, resp_bad):
    with pytest.raises(exceptions.ExceptionList) as exc:
        api._handle_response_data({'error': ['a', 'b']}, resp_bad, '')
    assert 'Server returned error messages ' in str(exc)
Ejemplo n.º 4
0
def test_bad_response(api, resp_bad):
    with pytest.raises(exceptions.NassException):
        api._handle_response_data({}, resp_bad, 'field')
Ejemplo n.º 5
0
def test_unexpected_response(api, resp_ok):
    with pytest.raises(exceptions.UnexpectedResponseData):
        api._handle_response_data({}, resp_ok, 'field')
Ejemplo n.º 6
0
def test_exceeds_row_limit_weird_format_2(api, resp_bad):
    with pytest.raises(exceptions.ExceedsRowLimit):
        api._handle_response_data({'error': ['exceeds limit=a']}, resp_bad, '')
Ejemplo n.º 7
0
def test_response_not_dict(api, resp_ok):
    with pytest.raises(exceptions.UnexpectedResponseData):
        api._handle_response_data(123, resp_ok, 'field')
Ejemplo n.º 8
0
def test_exception_list(api, resp_bad):
    with pytest.raises(exceptions.ExceptionList) as exc:
        api._handle_response_data({"error": ["a", "b"]}, resp_bad, "")
    assert "Server returned error messages " in str(exc)
Ejemplo n.º 9
0
def test_network_400(api, resp_bad):
    """Should get a NassException without explicit error message"""
    with pytest.raises(exceptions.NassException):
        api._handle_response_data({}, resp_bad, "")
Ejemplo n.º 10
0
def test_generic_error(api, resp_bad):
    with pytest.raises(exceptions.ApiException) as exc:
        api._handle_response_data({"error": ["blah"]}, resp_bad, "")
    assert "Server returned error message " in str(exc)
Ejemplo n.º 11
0
def test_unexpected_response(api, resp_ok):
    with pytest.raises(exceptions.UnexpectedResponseData):
        api._handle_response_data({}, resp_ok, "field")
Ejemplo n.º 12
0
def test_bad_response(api, resp_bad):
    with pytest.raises(exceptions.NassException):
        api._handle_response_data({}, resp_bad, "field")
Ejemplo n.º 13
0
def test_response_not_dict(api, resp_ok):
    with pytest.raises(exceptions.UnexpectedResponseData):
        api._handle_response_data(123, resp_ok, "field")
Ejemplo n.º 14
0
def test_exceeds_row_limit_weird_format_2(api, resp_bad):
    with pytest.raises(exceptions.ExceedsRowLimit):
        api._handle_response_data({"error": ["exceeds limit=a"]}, resp_bad, "")