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

Side by Side Diff: third_party/boto/tests/unit/ec2/test_address.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.address import Address 4 from boto.ec2.address import Address
5 5
6 class AddressTest(unittest.TestCase): 6 class AddressTest(unittest.TestCase):
7 def setUp(self): 7 def setUp(self):
8 self.address = Address() 8 self.address = Address()
9 self.address.connection = mock.Mock() 9 self.address.connection = mock.Mock()
10 self.address.public_ip = "192.168.1.1" 10 self.address.public_ip = "192.168.1.1"
(...skipping 17 matching lines...) Expand all
28 self.address.connection.release_address.assert_called_with( 28 self.address.connection.release_address.assert_called_with(
29 "192.168.1.1", 29 "192.168.1.1",
30 dry_run=False 30 dry_run=False
31 ) 31 )
32 32
33 def test_associate_calls_connection_associate_address_with_correct_args(self ): 33 def test_associate_calls_connection_associate_address_with_correct_args(self ):
34 self.address.associate(1) 34 self.address.associate(1)
35 self.address.connection.associate_address.assert_called_with( 35 self.address.connection.associate_address.assert_called_with(
36 1, 36 1,
37 "192.168.1.1", 37 "192.168.1.1",
38 allow_reassociation=False,
38 dry_run=False 39 dry_run=False
39 ) 40 )
40 41
41 def test_disassociate_calls_connection_disassociate_address_with_correct_arg s(self): 42 def test_disassociate_calls_connection_disassociate_address_with_correct_arg s(self):
42 self.address.disassociate() 43 self.address.disassociate()
43 self.address.connection.disassociate_address.assert_called_with( 44 self.address.connection.disassociate_address.assert_called_with(
44 "192.168.1.1", 45 "192.168.1.1",
45 dry_run=False 46 dry_run=False
46 ) 47 )
47 48
49
50 class AddressWithAllocationTest(unittest.TestCase):
51 def setUp(self):
52 self.address = Address()
53 self.address.connection = mock.Mock()
54 self.address.public_ip = "192.168.1.1"
55 self.address.allocation_id = "aid1"
56
57 def check_that_attribute_has_been_set(self, name, value, attribute):
58 self.address.endElement(name, value, None)
59 self.assertEqual(getattr(self.address, attribute), value)
60
61 def test_endElement_sets_correct_attributes_with_values(self):
62 for arguments in [("publicIp", "192.168.1.1", "public_ip"),
63 ("instanceId", 1, "instance_id"),
64 ("domain", "some domain", "domain"),
65 ("allocationId", 1, "allocation_id"),
66 ("associationId", 1, "association_id"),
67 ("somethingRandom", "somethingRandom", "somethingRando m")]:
68 self.check_that_attribute_has_been_set(arguments[0], arguments[1], a rguments[2])
69
70
71 def test_release_calls_connection_release_address_with_correct_args(self):
72 self.address.release()
73 self.address.connection.release_address.assert_called_with(
74 None,
75 "aid1",
76 dry_run=False
77 )
78
79 def test_associate_calls_connection_associate_address_with_correct_args(self ):
80 self.address.associate(1)
81 self.address.connection.associate_address.assert_called_with(
82 1,
83 "192.168.1.1",
84 allocation_id="aid1",
85 allow_reassociation=False,
86 dry_run=False
87 )
88
89 def test_disassociate_calls_connection_disassociate_address_with_correct_arg s(self):
90 self.address.disassociate()
91 self.address.connection.disassociate_address.assert_called_with(
92 "192.168.1.1",
93 dry_run=False
94 )
95
48 if __name__ == "__main__": 96 if __name__ == "__main__":
49 unittest.main() 97 unittest.main()
OLDNEW
« no previous file with comments | « third_party/boto/tests/unit/ec2/autoscale/test_group.py ('k') | third_party/boto/tests/unit/ec2/test_blockdevicemapping.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698