def test_multiple_error_class(self, container, error_handler, request_data,
                                  validators):
        error_instance = ValueError()
        interactor_mock = mock.Mock(side_effect=error_instance)
        interactor_function = interactor_factory(error_class=(LogicError,
                                                              ValueError),
                                                 error_handler=error_handler)
        interactor = interactor_function(
            *validators)(interactor_mock)(container)

        interactor(request_data)

        validators[0].assert_called_once_with(request_data)
        validators[1].assert_called_once_with(request_data)
        interactor_mock.assert_called_once_with(request_data)
        error_handler.assert_called_once_with(
            error=error_instance,
            function_name=
            'mock.mock.validated_by.<locals>.decorator.<locals>.decorated',
            args=(request_data, ),
            kwargs={})
示例#2
0
    def test_multiple_error_class(
            self, container, error_handler, request_data, validators):
        error_instance = ValueError()
        interactor_mock = mock.Mock(side_effect=error_instance)
        interactor_function = interactor_factory(
            error_class=(LogicError, ValueError),
            error_handler=error_handler
        )
        interactor = interactor_function(*validators)(interactor_mock)(container)

        interactor(request_data)

        validators[0].assert_called_once_with(request_data)
        validators[1].assert_called_once_with(request_data)
        interactor_mock.assert_called_once_with(request_data)
        error_handler.assert_called_once_with(
            error=error_instance,
            function_name='mock.mock.validated_by.<locals>.decorator.<locals>.decorated',
            args=(request_data,),
            kwargs={}
        )
 def interactor_function(self, error_handler):
     return interactor_factory(error_handler=error_handler)
示例#4
0
 def interactor_function(self, error_handler):
     return interactor_factory(error_handler=error_handler)