Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/boto/tests/unit/ec2/test_blockdevicemapping.py

Issue 698893003: Update checked in version of gsutil to version 4.6 (Closed) Base URL: http://dart.googlecode.com/svn/third_party/gsutil/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 import mock 1 import mock
2 import unittest 2 import unittest
3 3
4 from boto.ec2.connection import EC2Connection 4 from boto.ec2.connection import EC2Connection
5 from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping 5 from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping
6 6
7 from tests.unit import AWSMockServiceTestCase 7 from tests.unit import AWSMockServiceTestCase
8 8
9 9
10 class BlockDeviceTypeTests(unittest.TestCase): 10 class BlockDeviceTypeTests(unittest.TestCase):
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 b1.size == b2.size]) 58 b1.size == b2.size])
59 59
60 def test_startElement_with_name_ebs_sets_and_returns_current_value(self): 60 def test_startElement_with_name_ebs_sets_and_returns_current_value(self):
61 retval = self.block_device_mapping.startElement("ebs", None, None) 61 retval = self.block_device_mapping.startElement("ebs", None, None)
62 assert self.block_device_type_eq(retval, BlockDeviceType(self.block_devi ce_mapping)) 62 assert self.block_device_type_eq(retval, BlockDeviceType(self.block_devi ce_mapping))
63 63
64 def test_startElement_with_name_virtualName_sets_and_returns_current_value(s elf): 64 def test_startElement_with_name_virtualName_sets_and_returns_current_value(s elf):
65 retval = self.block_device_mapping.startElement("virtualName", None, Non e) 65 retval = self.block_device_mapping.startElement("virtualName", None, Non e)
66 assert self.block_device_type_eq(retval, BlockDeviceType(self.block_devi ce_mapping)) 66 assert self.block_device_type_eq(retval, BlockDeviceType(self.block_devi ce_mapping))
67 67
68 def test_endElement_with_name_device_sets_current_name(self): 68 def test_endElement_with_name_device_sets_current_name_dev_null(self):
69 self.block_device_mapping.endElement("device", "/dev/null", None) 69 self.block_device_mapping.endElement("device", "/dev/null", None)
70 self.assertEqual(self.block_device_mapping.current_name, "/dev/null") 70 self.assertEqual(self.block_device_mapping.current_name, "/dev/null")
71 71
72 def test_endElement_with_name_device_sets_current_name(self): 72 def test_endElement_with_name_device_sets_current_name(self):
73 self.block_device_mapping.endElement("deviceName", "some device name", N one) 73 self.block_device_mapping.endElement("deviceName", "some device name", N one)
74 self.assertEqual(self.block_device_mapping.current_name, "some device na me") 74 self.assertEqual(self.block_device_mapping.current_name, "some device na me")
75 75
76 def test_endElement_with_name_item_sets_current_name_key_to_current_value(se lf): 76 def test_endElement_with_name_item_sets_current_name_key_to_current_value(se lf):
77 self.block_device_mapping.current_name = "some name" 77 self.block_device_mapping.current_name = "some name"
78 self.block_device_mapping.current_value = "some value" 78 self.block_device_mapping.current_value = "some value"
(...skipping 10 matching lines...) Expand all
89 <DescribeLaunchConfigurationsResponse> 89 <DescribeLaunchConfigurationsResponse>
90 </DescribeLaunchConfigurationsResponse> 90 </DescribeLaunchConfigurationsResponse>
91 """ 91 """
92 92
93 def test_run_instances_block_device_mapping(self): 93 def test_run_instances_block_device_mapping(self):
94 # Same as the test in ``unit/ec2/autoscale/test_group.py:TestLaunchConfi guration``, 94 # Same as the test in ``unit/ec2/autoscale/test_group.py:TestLaunchConfi guration``,
95 # but with modified request parameters (due to a mismatch between EC2 & 95 # but with modified request parameters (due to a mismatch between EC2 &
96 # Autoscaling). 96 # Autoscaling).
97 self.set_http_response(status_code=200) 97 self.set_http_response(status_code=200)
98 dev_sdf = BlockDeviceType(snapshot_id='snap-12345') 98 dev_sdf = BlockDeviceType(snapshot_id='snap-12345')
99 dev_sdg = BlockDeviceType(snapshot_id='snap-12346') 99 dev_sdg = BlockDeviceType(snapshot_id='snap-12346', delete_on_terminatio n=True)
100 100
101 bdm = BlockDeviceMapping() 101 bdm = BlockDeviceMapping()
102 bdm['/dev/sdf'] = dev_sdf 102 bdm['/dev/sdf'] = dev_sdf
103 bdm['/dev/sdg'] = dev_sdg 103 bdm['/dev/sdg'] = dev_sdg
104 104
105 response = self.service_connection.run_instances( 105 response = self.service_connection.run_instances(
106 image_id='123456', 106 image_id='123456',
107 instance_type='m1.large', 107 instance_type='m1.large',
108 security_groups=['group1', 'group2'], 108 security_groups=['group1', 'group2'],
109 block_device_map=bdm 109 block_device_map=bdm
110 ) 110 )
111 111
112 self.assert_request_parameters({ 112 self.assert_request_parameters({
113 'Action': 'RunInstances', 113 'Action': 'RunInstances',
114 'BlockDeviceMapping.1.DeviceName': '/dev/sdf', 114 'BlockDeviceMapping.1.DeviceName': '/dev/sdf',
115 'BlockDeviceMapping.1.Ebs.DeleteOnTermination': 'false', 115 'BlockDeviceMapping.1.Ebs.DeleteOnTermination': 'false',
116 'BlockDeviceMapping.1.Ebs.SnapshotId': 'snap-12345', 116 'BlockDeviceMapping.1.Ebs.SnapshotId': 'snap-12345',
117 'BlockDeviceMapping.2.DeviceName': '/dev/sdg', 117 'BlockDeviceMapping.2.DeviceName': '/dev/sdg',
118 'BlockDeviceMapping.2.Ebs.DeleteOnTermination': 'false', 118 'BlockDeviceMapping.2.Ebs.DeleteOnTermination': 'true',
119 'BlockDeviceMapping.2.Ebs.SnapshotId': 'snap-12346', 119 'BlockDeviceMapping.2.Ebs.SnapshotId': 'snap-12346',
120 'ImageId': '123456', 120 'ImageId': '123456',
121 'InstanceType': 'm1.large', 121 'InstanceType': 'm1.large',
122 'MaxCount': 1, 122 'MaxCount': 1,
123 'MinCount': 1, 123 'MinCount': 1,
124 'SecurityGroup.1': 'group1', 124 'SecurityGroup.1': 'group1',
125 'SecurityGroup.2': 'group2', 125 'SecurityGroup.2': 'group2',
126 }, ignore_params_values=[ 126 }, ignore_params_values=[
127 'Version', 'AWSAccessKeyId', 'SignatureMethod', 'SignatureVersion', 127 'Version', 'AWSAccessKeyId', 'SignatureMethod', 'SignatureVersion',
128 'Timestamp' 128 'Timestamp'
129 ]) 129 ])
130 130
131 131
132 if __name__ == "__main__": 132 if __name__ == "__main__":
133 unittest.main() 133 unittest.main()
OLDNEW
« no previous file with comments | « third_party/boto/tests/unit/ec2/test_address.py ('k') | third_party/boto/tests/unit/ec2/test_connection.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698