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'
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
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
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'
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}
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