Exemplo n.º 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'
Exemplo n.º 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
Exemplo n.º 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
Exemplo n.º 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'
Exemplo n.º 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}
Exemplo n.º 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