Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/functional/sqs/test_add_permission.py
1567 views
1
#!/usr/bin/env python
2
# Copyright 2012-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License"). You
5
# may not use this file except in compliance with the License. A copy of
6
# the License is located at
7
#
8
# http://aws.amazon.com/apache2.0/
9
#
10
# or in the "license" file accompanying this file. This file is
11
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
12
# ANY KIND, either express or implied. See the License for the specific
13
# language governing permissions and limitations under the License.
14
from awscli.testutils import BaseAWSCommandParamsTest
15
import awscli.clidriver
16
17
18
class TestAddPermission(BaseAWSCommandParamsTest):
19
20
prefix = 'sqs add-permission'
21
queue_url = 'https://queue.amazonaws.com/4444/testcli'
22
23
def test_all_param(self):
24
cmdline = self.prefix
25
cmdline += ' --queue-url %s' % self.queue_url
26
cmdline += ' --aws-account-ids 888888888888'
27
cmdline += ' --actions SendMessage'
28
cmdline += ' --label FooBarLabel'
29
result = {'QueueUrl': self.queue_url,
30
'Actions': ['SendMessage'],
31
'AWSAccountIds': ['888888888888'],
32
'Label': 'FooBarLabel'}
33
self.assert_params_for_cmd(cmdline, result)
34
35
def test_multiple_accounts(self):
36
cmdline = self.prefix
37
cmdline += ' --queue-url %s' % self.queue_url
38
cmdline += ' --aws-account-ids 888888888888 999999999999'
39
cmdline += ' --actions SendMessage'
40
cmdline += ' --label FooBarLabel'
41
result = {'QueueUrl': self.queue_url,
42
'Actions': ['SendMessage'],
43
'AWSAccountIds': ['888888888888', '999999999999'],
44
'Label': 'FooBarLabel'}
45
self.assert_params_for_cmd(cmdline, result)
46
47
def test_multiple_actions(self):
48
cmdline = self.prefix
49
cmdline += ' --queue-url %s' % self.queue_url
50
cmdline += ' --aws-account-ids 888888888888'
51
cmdline += ' --actions SendMessage ReceiveMessage'
52
cmdline += ' --label FooBarLabel'
53
result = {'QueueUrl': self.queue_url,
54
'Actions': ['SendMessage', 'ReceiveMessage'],
55
'AWSAccountIds': ['888888888888'],
56
'Label': 'FooBarLabel'}
57
self.assert_params_for_cmd(cmdline, result)
58
59
60
if __name__ == "__main__":
61
unittest.main()
62
63