Revision eb172e55 test/py/cmdlib/cluster_unittest.py
b/test/py/cmdlib/cluster_unittest.py | ||
---|---|---|
37 | 37 |
from ganeti import utils |
38 | 38 |
from ganeti import pathutils |
39 | 39 |
from ganeti import rpc |
40 |
from ganeti import query |
|
40 | 41 |
from ganeti.cmdlib import cluster |
41 | 42 |
from ganeti.hypervisor import hv_xen |
42 | 43 |
|
... | ... | |
315 | 316 |
self.ExecOpCodeExpectOpExecError(op) |
316 | 317 |
|
317 | 318 |
|
319 |
class TestLUClusterConfigQuery(CmdlibTestCase): |
|
320 |
def testInvalidField(self): |
|
321 |
op = opcodes.OpClusterConfigQuery(output_fields=["pinky_bunny"]) |
|
322 |
|
|
323 |
self.ExecOpCodeExpectOpPrereqError(op, "pinky_bunny") |
|
324 |
|
|
325 |
def testAllFields(self): |
|
326 |
op = opcodes.OpClusterConfigQuery(output_fields=query.CLUSTER_FIELDS.keys()) |
|
327 |
|
|
328 |
self.rpc.call_get_watcher_pause.return_value = \ |
|
329 |
RpcResultsBuilder(self.cfg) \ |
|
330 |
.CreateSuccessfulNodeResult(self.cfg.GetMasterNode(), -1) |
|
331 |
|
|
332 |
ret = self.ExecOpCode(op) |
|
333 |
|
|
334 |
self.assertEqual(1, self.rpc.call_get_watcher_pause.call_count) |
|
335 |
self.assertEqual(len(ret), len(query.CLUSTER_FIELDS)) |
|
336 |
|
|
337 |
def testEmpytFields(self): |
|
338 |
op = opcodes.OpClusterConfigQuery(output_fields=[]) |
|
339 |
|
|
340 |
self.ExecOpCode(op) |
|
341 |
|
|
342 |
self.assertFalse(self.rpc.call_get_watcher_pause.called) |
|
343 |
|
|
344 |
|
|
318 | 345 |
if __name__ == "__main__": |
319 | 346 |
testutils.GanetiTestProgram() |
Also available in: Unified diff