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

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

Issue 12317103: Added gsutil to depot tools (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: added readme Created 7 years, 9 months 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
OLDNEW
(Empty)
1 import mock
2 import unittest
3
4 from boto.ec2.address import Address
5
6 class AddressTest(unittest.TestCase):
7 def setUp(self):
8 self.address = Address()
9 self.address.connection = mock.Mock()
10 self.address.public_ip = "192.168.1.1"
11
12 def check_that_attribute_has_been_set(self, name, value, attribute):
13 self.address.endElement(name, value, None)
14 self.assertEqual(getattr(self.address, attribute), value)
15
16 def test_endElement_sets_correct_attributes_with_values(self):
17 for arguments in [("publicIp", "192.168.1.1", "public_ip"),
18 ("instanceId", 1, "instance_id"),
19 ("domain", "some domain", "domain"),
20 ("allocationId", 1, "allocation_id"),
21 ("associationId", 1, "association_id"),
22 ("somethingRandom", "somethingRandom", "somethingRando m")]:
23 self.check_that_attribute_has_been_set(arguments[0], arguments[1], a rguments[2])
24
25
26 def test_release_calls_connection_release_address_with_correct_args(self):
27 self.address.release()
28 self.address.connection.release_address.assert_called_with("192.168.1.1" )
29
30 def test_associate_calls_connection_associate_address_with_correct_args(self ):
31 self.address.associate(1)
32 self.address.connection.associate_address.assert_called_with(1, "192.168 .1.1")
33
34 def test_disassociate_calls_connection_disassociate_address_with_correct_arg s(self):
35 self.address.disassociate()
36 self.address.connection.disassociate_address.assert_called_with("192.168 .1.1")
37
38 if __name__ == "__main__":
39 unittest.main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698