Revision 0e68bf27 test/ganeti.cmdlib_unittest.py
b/test/ganeti.cmdlib_unittest.py | ||
---|---|---|
570 | 570 |
new, None) |
571 | 571 |
|
572 | 572 |
|
573 |
def _ValidateCheckMinMaxSpec(name, *_):
|
|
573 |
def _ValidateComputeMinMaxSpec(name, *_):
|
|
574 | 574 |
assert name in constants.ISPECS_PARAMETERS |
575 | 575 |
return None |
576 | 576 |
|
... | ... | |
579 | 579 |
def __init__(self, spec): |
580 | 580 |
self.spec = spec |
581 | 581 |
|
582 |
def CheckMinMaxSpec(self, *args):
|
|
582 |
def ComputeMinMaxSpec(self, *args):
|
|
583 | 583 |
return self.spec.pop(0) |
584 | 584 |
|
585 | 585 |
|
586 | 586 |
class TestComputeIPolicySpecViolation(unittest.TestCase): |
587 | 587 |
def test(self): |
588 |
check_fn = _ValidateCheckMinMaxSpec
|
|
588 |
compute_fn = _ValidateComputeMinMaxSpec
|
|
589 | 589 |
ret = cmdlib._ComputeIPolicySpecViolation(NotImplemented, 1024, 1, 1, 1, |
590 |
[1024], _check_spec_fn=check_fn)
|
|
590 |
[1024], _compute_fn=compute_fn)
|
|
591 | 591 |
self.assertEqual(ret, []) |
592 | 592 |
|
593 | 593 |
def testInvalidArguments(self): |
... | ... | |
596 | 596 |
|
597 | 597 |
def testInvalidSpec(self): |
598 | 598 |
spec = _SpecWrapper([None, False, "foo", None, "bar"]) |
599 |
check_fn = spec.CheckMinMaxSpec
|
|
599 |
compute_fn = spec.ComputeMinMaxSpec
|
|
600 | 600 |
ret = cmdlib._ComputeIPolicySpecViolation(NotImplemented, 1024, 1, 1, 1, |
601 |
[1024], _check_spec_fn=check_fn)
|
|
601 |
[1024], _compute_fn=compute_fn)
|
|
602 | 602 |
self.assertEqual(ret, ["foo", "bar"]) |
603 | 603 |
self.assertFalse(spec.spec) |
604 | 604 |
|
Also available in: Unified diff