コード例 #1
0
def test_response_failure_initialization_with_exception(response_type):
    response = ResponseFailure(response_type,
                               Exception('Just an exception message'))

    assert bool(response) is False
    assert response.type == response_type
    assert response.message == 'Exception: Just an exception message'
コード例 #2
0
def test_response_failure_contains_value(response_type, response_message):
    response = ResponseFailure(response_type, response_message)

    assert response.value == {
        'type': response_type,
        'message': response_message
    }
コード例 #3
0
def test_response_failure_has_type_and_message(response_type,
                                               response_message):
    response = ResponseFailure(response_type, response_message)

    assert response.type == response_type
    assert response.message == response_message
コード例 #4
0
def test_response_failure_is_false(response_type, response_message):
    assert bool(ResponseFailure(response_type, response_message)) is False