Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/tests/functional/ec2/test_associate_address.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 TestAssociateAddress(BaseAWSCommandParamsTest):
18
19
prefix = 'ec2 associate-address'
20
21
def test_basic(self):
22
cmdline = self.prefix
23
cmdline += ' --instance-id i-12345678'
24
cmdline += ' --public-ip 192.168.0.0'
25
result = {'InstanceId': 'i-12345678', 'PublicIp': '192.168.0.0'}
26
self.assert_params_for_cmd(cmdline, result)
27
28
def test_vpc_basic(self):
29
cmdline = self.prefix
30
cmdline += ' --instance-id i-12345678'
31
cmdline += ' --public-ip 192.168.0.0'
32
cmdline += ' --allocation-id eipalloc-12345678'
33
cmdline += ' --allow-reassociation'
34
result = {'InstanceId': 'i-12345678',
35
'PublicIp': '192.168.0.0',
36
'AllowReassociation': True,
37
'AllocationId': 'eipalloc-12345678'}
38
self.assert_params_for_cmd(cmdline, result)
39
40
41
if __name__ == "__main__":
42
unittest.main()
43
44