def read_detail(self, request): """ Implements the Read Detail (read an object) maps to GET /api/objects/:id/ in rest semantics :param request: rip.Request :return: rip.Response """ pipeline = crud_pipeline_factory.read_detail_pipeline( configuration=self.configuration) return pipeline(request=request)
def test_read_detail_pipeline_has_all_steps_in_the_right_order(self, compose_pipeline): entity_actions = MagicMock() entity_actions.read_detail = read_detail = MagicMock() authentication = MagicMock() authentication.authenticate = MagicMock() authorization = MagicMock() authorization.authorize_read_detail = authorize_read_detail = MagicMock() cleaner = MagicMock() cleaner.clean_data_for_read_detail = clean_data_for_read_detail = MagicMock() serializer = MagicMock() serializer.serialize_detail = serialize_detail = MagicMock() response_converter = MagicMock() response_converter.convert_serialized_data_to_response = convert_serialized_data_to_response = MagicMock() post_action_hooks = MagicMock() post_action_hooks.read_detail_hook = read_detail_hook = MagicMock() compose_pipeline.return_value = expected_pipeline = MagicMock() configuration = { "entity_actions": entity_actions, "authentication": authentication, "authorization": authorization, "serializer": serializer, "data_cleaner": cleaner, "response_converter": response_converter, "post_action_hooks": post_action_hooks, } pipeline = crud_pipeline_factory.read_detail_pipeline(configuration) assert_that(pipeline, equal_to(expected_pipeline)) compose_pipeline.assert_called_once_with( name=CrudActions.READ_DETAIL, pipeline=[ authentication.authenticate, clean_data_for_read_detail, read_detail, authorize_read_detail, serialize_detail, read_detail_hook, convert_serialized_data_to_response, ], )
def test_read_detail_pipeline_has_all_steps_in_the_right_order( self, compose_pipeline): entity_actions = MagicMock() entity_actions.read_detail = read_detail = MagicMock() authentication = MagicMock() authentication.authenticate = MagicMock() authorization = MagicMock() authorization \ .authorize_read_detail = authorize_read_detail = MagicMock() cleaner = MagicMock() cleaner.clean_data_for_read_detail = \ clean_data_for_read_detail = MagicMock() serializer = MagicMock() serializer.serialize_detail = serialize_detail = MagicMock() response_converter = MagicMock() response_converter.convert_serialized_data_to_response = \ convert_serialized_data_to_response = MagicMock() post_action_hooks = MagicMock() post_action_hooks.read_detail_hook = read_detail_hook = MagicMock() compose_pipeline.return_value = expected_pipeline = MagicMock() configuration = { 'entity_actions': entity_actions, 'authentication': authentication, 'authorization': authorization, 'serializer': serializer, 'data_cleaner': cleaner, 'response_converter': response_converter, 'post_action_hooks': post_action_hooks } pipeline = crud_pipeline_factory.read_detail_pipeline(configuration) assert_that(pipeline, equal_to(expected_pipeline)) compose_pipeline.assert_called_once_with( name=CrudActions.READ_DETAIL, pipeline=[ authentication.authenticate, clean_data_for_read_detail, read_detail, authorize_read_detail, serialize_detail, read_detail_hook, convert_serialized_data_to_response ])