def test_handle_call(self, request_builder, mocker): def dummy(arg1): return arg1 request_builder.get_converter.return_value = dummy get_call_args = mocker.patch("uplink.utils.get_call_args") get_call_args.return_value = {"arg1": "hello"} annotation = mocker.Mock(arguments.ArgumentAnnotation) handlers = arguments.ArgumentAnnotationHandler(dummy, {"arg1": annotation}) handlers.handle_call(request_builder, (), {}) annotation.modify_request.assert_called_with(request_builder, "hello")
def test_annotations(self, args): annotations = ["annotation"] * len(args) arg_dict = dict(zip(args, annotations)) annotation_handler = arguments.ArgumentAnnotationHandler( None, arg_dict) assert list(annotation_handler.annotations) == annotations
def test_get_relevant_arguments(self): args = {"arg1": "value1"} annotation_handler = arguments.ArgumentAnnotationHandler(None, args) relevant = annotation_handler.get_relevant_arguments(args) assert list(relevant) == list(args.items())