예제 #1
0
def test_response_failure_contains_value(response_type, response_message):
    error = errors.Error(response_type, response_message)
    response = response_object.ResponseFailure.from_error(error)

    assert response.value == 'This is a response error'
예제 #2
0
def test_response_failure_has_type_and_value(response_type, response_message):
    error = errors.Error(response_type, response_message)
    response = response_object.ResponseFailure(error)

    assert response.type == response_type
    assert response.value == response_message
예제 #3
0
def test_response_failure_is_false(response_type, response_message):
    error = errors.Error(response_type, response_message)
    assert bool(response_object.ResponseFailure(error)) is False
예제 #4
0
def test_response_failure_initialization_with_exception():
    error = errors.Error(error_type, Exception('Just an error message'))

    assert error.type == error_type
    assert error.message == 'Exception: Just an error message'
예제 #5
0
def test_error_contains_value(error_type, error_message):
    error = errors.Error(error_type, error_message)

    assert error.value == {'type': error_type, 'message': error_message}
예제 #6
0
def test_error_has_type_and_message(error_type, error_message):
    error = errors.Error(error_type, error_message)

    assert error.type == error_type
    assert error.message == error_message