Revision 915faf72 test/ganeti.rapi.client_unittest.py
b/test/ganeti.rapi.client_unittest.py | ||
---|---|---|
26 | 26 |
import warnings |
27 | 27 |
import pycurl |
28 | 28 |
|
29 |
from ganeti import opcodes |
|
29 | 30 |
from ganeti import constants |
30 | 31 |
from ganeti import http |
31 | 32 |
from ganeti import serializer |
... | ... | |
46 | 47 |
_KNOWN_UNUSED = set([ |
47 | 48 |
rlib2.R_root, |
48 | 49 |
rlib2.R_2, |
49 |
rlib2.R_2_instances_multi_alloc, |
|
50 | 50 |
]) |
51 | 51 |
|
52 | 52 |
# Global variable for collecting used handlers |
... | ... | |
481 | 481 |
self.assertItems(["inst32"]) |
482 | 482 |
self.assertQuery("static", ["1"]) |
483 | 483 |
|
484 |
def testInstancesMultiAlloc(self): |
|
485 |
response = { |
|
486 |
constants.JOB_IDS_KEY: ["23423"], |
|
487 |
opcodes.OpInstanceMultiAlloc.ALLOCATABLE_KEY: ["foobar"], |
|
488 |
opcodes.OpInstanceMultiAlloc.FAILED_KEY: ["foobar2"], |
|
489 |
} |
|
490 |
self.rapi.AddResponse(serializer.DumpJson(response)) |
|
491 |
insts = [self.client.InstanceAllocation("create", "foobar", |
|
492 |
"plain", [], []), |
|
493 |
self.client.InstanceAllocation("create", "foobar2", |
|
494 |
"drbd8", [{"size": 100}], [])] |
|
495 |
resp = self.client.InstancesMultiAlloc(insts) |
|
496 |
self.assertEqual(resp, response) |
|
497 |
self.assertHandler(rlib2.R_2_instances_multi_alloc) |
|
498 |
|
|
484 | 499 |
def testCreateInstanceOldVersion(self): |
485 | 500 |
# The old request format, version 0, is no longer supported |
486 | 501 |
self.rapi.AddResponse(None, code=404) |
Also available in: Unified diff