Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/functional/quicksight/test_assetbundle_parameters.py
1567 views
1
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License"). You
4
# may not use this file except in compliance with the License. A copy of
5
# the License is located at
6
#
7
# http://aws.amazon.com/apache2.0/
8
#
9
# or in the "license" file accompanying this file. This file is
10
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
# ANY KIND, either express or implied. See the License for the specific
12
# language governing permissions and limitations under the License.
13
from awscli.testutils import BaseAWSCommandParamsTest
14
from awscli.testutils import FileCreator
15
16
17
class BaseQuickSightAssetBundleTest(BaseAWSCommandParamsTest):
18
def setUp(self):
19
super(BaseQuickSightAssetBundleTest, self).setUp()
20
self.files = FileCreator()
21
self.temp_file = self.files.create_file(
22
'foo', 'mycontents')
23
with open(self.temp_file, 'rb') as f:
24
self.temp_file_bytes = f.read()
25
26
def tearDown(self):
27
super(BaseQuickSightAssetBundleTest, self).tearDown()
28
self.files.remove_all()
29
30
31
class TestStartAssetBundleImportJob(BaseQuickSightAssetBundleTest):
32
prefix = 'quicksight start-asset-bundle-import-job ' \
33
'--aws-account-id 123456789012 ' \
34
'--asset-bundle-import-job-id import-job-1 '
35
36
def test_can_provide_source_body_as_top_level_param(self):
37
cmdline = self.prefix
38
cmdline += f' --asset-bundle-import-source-bytes fileb://{self.temp_file}'
39
result = {
40
'AwsAccountId': '123456789012',
41
'AssetBundleImportJobId': 'import-job-1',
42
'AssetBundleImportSource': {'Body': self.temp_file_bytes},
43
}
44
self.assert_params_for_cmd(cmdline, result)
45
46
def test_can_provide_source_body_as_nested_param(self):
47
cmdline = self.prefix
48
cmdline += ' --asset-bundle-import-source Body=aGVsbG8gd29ybGQ='
49
result = {
50
'AwsAccountId': '123456789012',
51
'AssetBundleImportJobId': 'import-job-1',
52
'AssetBundleImportSource': {'Body': 'aGVsbG8gd29ybGQ='},
53
}
54
self.assert_params_for_cmd(cmdline, result)
55
56