예제 #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, '')
예제 #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)
예제 #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)
예제 #4
0
def test_bad_response(api, resp_bad):
    with pytest.raises(exceptions.NassException):
        api._handle_response_data({}, resp_bad, 'field')
예제 #5
0
def test_unexpected_response(api, resp_ok):
    with pytest.raises(exceptions.UnexpectedResponseData):
        api._handle_response_data({}, resp_ok, 'field')
예제 #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, '')
예제 #7
0
def test_response_not_dict(api, resp_ok):
    with pytest.raises(exceptions.UnexpectedResponseData):
        api._handle_response_data(123, resp_ok, 'field')
예제 #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)
예제 #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, "")
예제 #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)
예제 #11
0
def test_unexpected_response(api, resp_ok):
    with pytest.raises(exceptions.UnexpectedResponseData):
        api._handle_response_data({}, resp_ok, "field")
예제 #12
0
def test_bad_response(api, resp_bad):
    with pytest.raises(exceptions.NassException):
        api._handle_response_data({}, resp_bad, "field")
예제 #13
0
def test_response_not_dict(api, resp_ok):
    with pytest.raises(exceptions.UnexpectedResponseData):
        api._handle_response_data(123, resp_ok, "field")
예제 #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, "")