Path: blob/develop/tests/functional/quicksight/test_assetbundle_parameters.py
1567 views
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.1#2# Licensed under the Apache License, Version 2.0 (the "License"). You3# may not use this file except in compliance with the License. A copy of4# the License is located at5#6# http://aws.amazon.com/apache2.0/7#8# or in the "license" file accompanying this file. This file is9# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF10# ANY KIND, either express or implied. See the License for the specific11# language governing permissions and limitations under the License.12from awscli.testutils import BaseAWSCommandParamsTest13from awscli.testutils import FileCreator141516class BaseQuickSightAssetBundleTest(BaseAWSCommandParamsTest):17def setUp(self):18super(BaseQuickSightAssetBundleTest, self).setUp()19self.files = FileCreator()20self.temp_file = self.files.create_file(21'foo', 'mycontents')22with open(self.temp_file, 'rb') as f:23self.temp_file_bytes = f.read()2425def tearDown(self):26super(BaseQuickSightAssetBundleTest, self).tearDown()27self.files.remove_all()282930class TestStartAssetBundleImportJob(BaseQuickSightAssetBundleTest):31prefix = 'quicksight start-asset-bundle-import-job ' \32'--aws-account-id 123456789012 ' \33'--asset-bundle-import-job-id import-job-1 '3435def test_can_provide_source_body_as_top_level_param(self):36cmdline = self.prefix37cmdline += f' --asset-bundle-import-source-bytes fileb://{self.temp_file}'38result = {39'AwsAccountId': '123456789012',40'AssetBundleImportJobId': 'import-job-1',41'AssetBundleImportSource': {'Body': self.temp_file_bytes},42}43self.assert_params_for_cmd(cmdline, result)4445def test_can_provide_source_body_as_nested_param(self):46cmdline = self.prefix47cmdline += ' --asset-bundle-import-source Body=aGVsbG8gd29ybGQ='48result = {49'AwsAccountId': '123456789012',50'AssetBundleImportJobId': 'import-job-1',51'AssetBundleImportSource': {'Body': 'aGVsbG8gd29ybGQ='},52}53self.assert_params_for_cmd(cmdline, result)545556