How to use the awscli.testutils.FileCreator function in awscli

To help you get started, we’ve selected a few awscli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cli / tests / unit / test_topictags.py View on Github external
def setUp(self):
        self.topic_tag_db = TopicTagDB()
        self.file_creator = FileCreator()
github aws / aws-cli / tests / functional / history / __init__.py View on Github external
def setUp(self):
        history_recorder = self._make_clean_history_recorder()
        super(BaseHistoryCommandParamsTest, self).setUp()
        self.history_recorder = history_recorder
        self.files = FileCreator()
        config_contents = (
            '[default]\n'
            'cli_history = enabled'
        )
        self.environ['AWS_CONFIG_FILE'] = self.files.create_file(
            'config', config_contents)
        self.environ['AWS_CLI_HISTORY_FILE'] = self.files.create_file(
            'history.db', '')
        self.driver = create_clidriver()
github aws / aws-cli / tests / integration / customizations / s3 / test_s3handler.py View on Github external
def setUp(self):
        self.session = botocore.session.get_session(EnvironmentVariables)
        self.client = self.session.create_client('s3', 'us-west-2')
        self.source_client = self.session.create_client('s3', 'us-west-2')
        params = {'region': 'us-west-2'}
        self.s3_handler = S3Handler(self.session, params)
        self.bucket = make_s3_files(self.session)
        self.file_creator = FileCreator()
        self.loc_files = make_loc_files(self.file_creator)
github aws / aws-cli / tests / unit / customizations / s3 / test_subcommands.py View on Github external
def setUp(self):
        super(CommandArchitectureTest, self).setUp()
        self.session = self.driver.session
        self.bucket = 'mybucket'
        self.file_creator = FileCreator()
        self.loc_files = make_loc_files(self.file_creator)
        self.output = StringIO()
        self.err_output = StringIO()
        self.saved_stdout = sys.stdout
        self.saved_stderr = sys.stderr
        sys.stdout = self.output
        sys.stderr = self.err_output
github aws / aws-cli / tests / unit / s3 / test_put_object.py View on Github external
def setUp(self):
        super(TestPutObject, self).setUp()
        self.file_path = os.path.join(os.path.dirname(__file__),
                                      'test_put_object_data')
        self.files = FileCreator()
github aws / aws-cli / tests / functional / test_timeformat.py View on Github external
def setUp(self):
        super(TestCLITimestampParser, self).setUp()
        self.files = FileCreator()
        self.wire_response = json.dumps({
            'builds': [{
                'startTime': 0,
            }]
        }).encode('utf-8')
        self.command = ['codebuild', 'batch-get-builds', '--ids', 'foo']
        self.patch_send(content=self.wire_response)
github aws / aws-cli / tests / functional / test_output.py View on Github external
def setUp(self):
        super(TestOutput, self).setUp()
        self.files = FileCreator()

        self.patch_popen = mock.patch('awscli.utils.Popen')
        self.mock_popen = self.patch_popen.start()

        self.patch_tty = mock.patch('awscli.utils.is_a_tty')
        self.mock_is_a_tty = self.patch_tty.start()
        self.mock_is_a_tty.return_value = True

        self.cmdline = 'ec2 describe-regions'
        self.parsed_response = {
            "Regions": [
                {
                        "Endpoint": "ec2.ap-south-1.amazonaws.com",
                        "RegionName": "ap-south-1"
                },
            ]
github aws / aws-cli / tests / unit / test_alias.py View on Github external
def setUp(self):
        self.files = FileCreator()
        self.alias_file = self.files.create_file('alias', '[toplevel]\n')
        self.alias_loader = AliasLoader(self.alias_file)
        self.session = mock.Mock(spec=Session)
        self.alias_cmd_injector = AliasCommandInjector(
            self.session, self.alias_loader)
        self.command_table = {}
        self.parser = MainArgParser(
            command_table=self.command_table,
            version_string='version',
            description='description',
            argument_table={}
        )
github aws / aws-cli / tests / unit / test_paramfile.py View on Github external
def setUp(self):
        self.files = FileCreator()
github aws / aws-cli / tests / unit / customizations / gamelift / test_uploadbuild.py View on Github external
def setUp(self):
        self.create_client_patch = mock.patch(
            'botocore.session.Session.create_client')
        self.mock_create_client = self.create_client_patch.start()
        self.session = get_session()

        self.gamelift_client = mock.Mock()
        self.s3_client = mock.Mock()
        self.mock_create_client.side_effect = [
            self.gamelift_client, self.s3_client
        ]

        self.file_creator = FileCreator()
        self.upload_file_patch = mock.patch(
            'awscli.customizations.gamelift.uploadbuild.S3Transfer.upload_file'
        )
        self.upload_file_mock = self.upload_file_patch.start()

        self.cmd = UploadBuildCommand(self.session)
        self._setup_input_output()