Revision f2f88abf test/ganeti.rapi.client_unittest.py
b/test/ganeti.rapi.client_unittest.py | ||
---|---|---|
145 | 145 |
""" |
146 | 146 |
|
147 | 147 |
def setUp(self): |
148 |
# Monkey-patch a fake VerifyCertificate function |
|
149 |
self._verify_certificate = client._VerifyCertificate |
|
150 |
client._VerifyCertificate = lambda x, y, z: True |
|
151 |
|
|
152 | 148 |
self.rapi = RapiMock() |
153 | 149 |
self.http = HttpMock(self.rapi) |
154 | 150 |
self.client = client.GanetiRapiClient('master.foo.com') |
... | ... | |
156 | 152 |
# Hard-code the version for easier testing. |
157 | 153 |
self.client._version = 2 |
158 | 154 |
|
159 |
def tearDown(self): |
|
160 |
# Un-do the monkey-patch |
|
161 |
client._VerifyCertificate = self._verify_certificate |
|
162 |
|
|
163 | 155 |
def assertHandler(self, handler_cls): |
164 | 156 |
self.failUnless(isinstance(self.rapi.GetLastHandler(), handler_cls)) |
165 | 157 |
|
... | ... | |
392 | 384 |
self.assertHandler(rlib2.R_2_nodes_name_role) |
393 | 385 |
self.assertItems(["node-foo"]) |
394 | 386 |
self.assertQuery("force", ["True"]) |
395 |
self.assertEqual("master-candidate", self.http.last_request_body)
|
|
387 |
self.assertEqual("\"master-candidate\"", self.http.last_request_body)
|
|
396 | 388 |
|
397 | 389 |
self.assertRaises(client.InvalidNodeRole, |
398 | 390 |
self.client.SetNodeRole, "node-bar", "fake-role") |
Also available in: Unified diff