示例#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, "")