Revision a903ca89 test/py/ganeti.rapi.rlib2_unittest.py
b/test/py/ganeti.rapi.rlib2_unittest.py | ||
---|---|---|
558 | 558 |
self.assertRaises(IndexError, cl.GetNextSubmittedJob) |
559 | 559 |
|
560 | 560 |
|
561 |
class TestInstanceModify(): |
|
562 |
def testCustomParamRename(self): |
|
563 |
clfactory = _FakeClientFactory(_FakeClient) |
|
564 |
|
|
565 |
name = "instant_instance" |
|
566 |
data = { |
|
567 |
"custom_beparams": {}, |
|
568 |
"custom_hvparams": {}, |
|
569 |
"custom_nicparams": {}, |
|
570 |
} |
|
571 |
|
|
572 |
handler = _CreateHandler(rlib2.R_2_instances_name_modify, [name], {}, data, |
|
573 |
clfactory) |
|
574 |
job_id = handler.PUT() |
|
575 |
|
|
576 |
cl = clfactory.GetNextClient() |
|
577 |
self.assertRaises(IndexError, clfactory.GetNextClient) |
|
578 |
|
|
579 |
(exp_job_id, (op, )) = cl.GetNextSubmittedJob() |
|
580 |
self.assertEqual(job_id, exp_job_id) |
|
581 |
|
|
582 |
self.assertTrue(isinstance(op, opcodes.OpInstanceSetParams)) |
|
583 |
self.assertEqual(op.beparams, {}) |
|
584 |
self.assertEqual(op.hvparams, {}) |
|
585 |
self.assertEqual(op.nicparams, {}) |
|
586 |
|
|
587 |
self.assertRaises(IndexError, cl.GetNextSubmittedJob) |
|
588 |
|
|
589 |
# Define both |
|
590 |
data["beparams"] = {} |
|
591 |
assert "beparams" in data and "custom_beparams" in data |
|
592 |
handler = _CreateHandler(rlib2.R_2_instances_name_modify, [name], {}, data, |
|
593 |
clfactory) |
|
594 |
self.assertRaises(http.HttpBadRequest, handler.PUT) |
|
595 |
|
|
596 |
|
|
561 | 597 |
class TestBackupPrepare(unittest.TestCase): |
562 | 598 |
def test(self): |
563 | 599 |
clfactory = _FakeClientFactory(_FakeClient) |
Also available in: Unified diff