def handle_csv(request): request_data = rpc_handler_obj.raw_request_data(request) decoded_request = rpc_handler_obj.decode_request(request_data) result = rpc_handler_obj.dispatch_request(decoded_request) encoder = csv_encoder.encoder(decoded_request, result) return encoder.encode()
def _encode_and_check_result(self, request, result, *expected_csv_rows): encoder = csv_encoder.encoder(request, result) response = encoder.encode() csv_result = response.content expected_csv = '\r\n'.join(expected_csv_rows) + '\r\n' self.assertEquals(csv_result, expected_csv)