def setUpClass(cls) -> None: queue = CommandQueue() queue.add_command(TouchFileCommand(PREPARE_TEST_DATA_PATH)) queue.add_command( S3PutCommand(Container().component('S3_COMPONENT.ID=UT'), PREPARE_TEST_DATA_PATH, os.path.basename(PREPARE_TEST_DATA_PATH))) queue.execute()
def __init__(self, *args, **kwargs): self._component = \ Container().component('S3_COMPONENT.ID=UT') self._test_data_path = \ os.path.join( os.path.dirname(__file__), 'test_data' ) super().__init__(*args, **kwargs)
def setUpClass(cls) -> None: queue = CommandQueue() for test_data_path in TEST_DATA_PATH_LIST: queue.add_command(TouchFileCommand(test_data_path)) queue.add_command( ScpPutCommand(Container().component('SCP_COMPONENT.ID=UT'), TEST_DATA_PATH_LIST, REMOTE_DIR, False, False)) queue.execute()
def __init__(self, *args, **kwargs): self._component = Container().component('POSTGRESQL_COMPONENT.ID=UT') self._sql_str = ( 'select count(*) from ' '(select current_timestamp' ' union all' ' select current_timestamp union all select current_timestamp) t;') super().__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): self._component = Container().component('CONFLUENCE_COMPONENT.ID=UT') self._page_title = os.path.splitext(os.path.basename(__file__))[0] self._space_key = 'SPC' self._headers = {'content-type': 'application/json'} self._type = 'page' self._ancestors_id = '2392085' self._html_str = f'<div style="font-size:500%">{self._page_title}</div>' self._description = f'created by {os.path.basename(__file__)}' super().__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): self._component = Container().component('CONFLUENCE_COMPONENT.ID=UT') self._page_title = os.path.splitext(os.path.basename(__file__))[0] self._space_key = 'SPC' self._headers = {'content-type': 'application/json'} self._type = 'page' self._ancestors_id = '2392085' self._description = f'created by {os.path.basename(__file__)}' self._test_data_path = \ os.path.join( os.path.dirname(__file__), TEST_DATA_DIR ) super().__init__(*args, **kwargs)
def setUpClass(cls) -> None: queue = CommandQueue() for test_data_path in TEST_DATA_PATH_LIST: queue.add_command( TouchFileCommand(test_data_path) ) queue.add_command( S3PutCommand( Container().component('S3_COMPONENT.ID=UT'), test_data_path, f'test_s3_list_command/{os.path.basename(test_data_path)}' ) ) queue.execute()
def __init__(self, kwargs: dict): component = Container.component(kwargs['component_key']) sql_str = FileUtil.file_to_str(kwargs['sql_file_name']) self._output_dir = kwargs['output_dir'] super().__init__(component, sql_str)
def __init__(self, *args, **kwargs): self._component = \ Container().component('S3_COMPONENT.ID=UT') super().__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): self._component = Container.component('POSTGRESQL_COMPONENT.ID=UT') self._sql_str = 'select current_timestamp' super().__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): self._component = Container.component( 'PLUGIN_COMPONENT.ID=TEST_COMPONENT') super().__init__(*args, **kwargs)
def test_container(self): component = \ Container().component( 'POSTGRESQL_COMPONENT.ID=TEST_COMPONENT' ) self.assertEqual(component.database, 'test_database')
# -*- coding: utf-8 -*- import os from ....abc.base_test_case import BaseTestCase from jetline.command.command_queue import CommandQueue from jetline.command.db.postgresql.postgresql_processing_command import PostgreSQLProcessingCommand from jetline.command.db.postgresql.postgresql_copy_from_command import PostgreSQLCopyFromCommand from jetline.container.container import Container from jetline.share_parameter.share_parameter import ShareParameter COMPONENT = Container().component('POSTGRESQL_COMPONENT.ID=UT') TABLE_NAME = f'{COMPONENT.schema}.test_postgresql_copy_from_command' TEST_DATA_DIR = 'test_data' class TestPostgreSQLCopyFromCommand(BaseTestCase): def __init__(self, *args, **kwargs): self._test_data_path = \ os.path.join( os.path.dirname(__file__), TEST_DATA_DIR ) super().__init__(*args, **kwargs) @classmethod def setUpClass(cls): ShareParameter.dry_run_mode = False queue = CommandQueue() sql_str = 'drop table if exists {table_name}' queue.add_command( PostgreSQLProcessingCommand( COMPONENT,