Revision f2c6673d test/ganeti.cli_unittest.py
b/test/ganeti.cli_unittest.py | ||
---|---|---|
729 | 729 |
[(3, { "mode": [], })]) |
730 | 730 |
|
731 | 731 |
|
732 |
class TestFormatResultError(unittest.TestCase): |
|
733 |
def testNormal(self): |
|
734 |
for verbose in [False, True]: |
|
735 |
self.assertRaises(AssertionError, cli.FormatResultError, |
|
736 |
constants.RS_NORMAL, verbose) |
|
737 |
|
|
738 |
def testUnknown(self): |
|
739 |
for verbose in [False, True]: |
|
740 |
self.assertRaises(NotImplementedError, cli.FormatResultError, |
|
741 |
"#some!other!status#", verbose) |
|
742 |
|
|
743 |
def test(self): |
|
744 |
for status in constants.RS_ALL: |
|
745 |
if status == constants.RS_NORMAL: |
|
746 |
continue |
|
747 |
|
|
748 |
self.assertNotEqual(cli.FormatResultError(status, False), |
|
749 |
cli.FormatResultError(status, True)) |
|
750 |
|
|
751 |
result = cli.FormatResultError(status, True) |
|
752 |
self.assertTrue(result.startswith("(")) |
|
753 |
self.assertTrue(result.endswith(")")) |
|
754 |
|
|
755 |
|
|
732 | 756 |
if __name__ == '__main__': |
733 | 757 |
testutils.GanetiTestProgram() |
Also available in: Unified diff