Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/functional/sns/test_create_platform_application.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
16
17
class TestCreatePlatformApplication(BaseAWSCommandParamsTest):
18
19
prefix = 'sns create-platform-application'
20
21
def test_gcm_shorthand(self):
22
cmdline = self.prefix
23
cmdline += ' --name gcmpushapp'
24
cmdline += ' --platform GCM'
25
cmdline += ' --attributes '
26
cmdline += 'PlatformCredential=foo,'
27
cmdline += 'PlatformPrincipal=bar'
28
result = {'Name': 'gcmpushapp',
29
'Platform': 'GCM',
30
'Attributes': {'PlatformCredential': 'foo',
31
'PlatformPrincipal': 'bar'}}
32
self.assert_params_for_cmd(cmdline, result)
33
34
def test_gcm_json(self):
35
cmdline = self.prefix
36
cmdline += ' --name gcmpushapp'
37
cmdline += ' --platform GCM'
38
cmdline += ' --attributes '
39
cmdline += ('{"PlatformCredential":"AIzaSyClE2lcV2zEKTLYYo645zfk2jhQPFeyxDo",'
40
'"PlatformPrincipal":"There+is+no+principal+for+GCM"}')
41
result = {
42
'Name': 'gcmpushapp',
43
'Platform': 'GCM',
44
'Attributes': {
45
'PlatformCredential': 'AIzaSyClE2lcV2zEKTLYYo645zfk2jhQPFeyxDo',
46
'PlatformPrincipal': 'There+is+no+principal+for+GCM'}
47
}
48
self.assert_params_for_cmd(cmdline, result)
49
50
51
if __name__ == "__main__":
52
unittest.main()
53
54