Revision b01b7a50 test/py/ganeti.backend_unittest.py
b/test/py/ganeti.backend_unittest.py | ||
---|---|---|
21 | 21 |
|
22 | 22 |
"""Script for testing ganeti.backend""" |
23 | 23 |
|
24 |
import mock |
|
24 | 25 |
import os |
25 | 26 |
import shutil |
26 | 27 |
import tempfile |
28 |
import testutils |
|
27 | 29 |
import unittest |
28 |
import mock |
|
29 | 30 |
|
30 |
from ganeti import utils |
|
31 |
from ganeti import constants |
|
32 | 31 |
from ganeti import backend |
33 |
from ganeti import netutils |
|
32 |
from ganeti import constants |
|
33 |
from ganeti import errors |
|
34 | 34 |
from ganeti import hypervisor |
35 |
|
|
36 |
import testutils
|
|
35 |
from ganeti import netutils |
|
36 |
from ganeti import utils
|
|
37 | 37 |
|
38 | 38 |
|
39 | 39 |
class TestX509Certificates(unittest.TestCase): |
... | ... | |
618 | 618 |
class TestApplyStorageInfoFunction(unittest.TestCase): |
619 | 619 |
|
620 | 620 |
_STORAGE_KEY = "some_key" |
621 |
_SOME_ARGS = "some_args"
|
|
621 |
_SOME_ARGS = ["some_args"]
|
|
622 | 622 |
|
623 | 623 |
def setUp(self): |
624 | 624 |
self.mock_storage_fn = mock.Mock() |
... | ... | |
650 | 650 |
storage_type, self._STORAGE_KEY, self._SOME_ARGS) |
651 | 651 |
|
652 | 652 |
|
653 |
class TestCheckStorageParams(unittest.TestCase): |
|
654 |
|
|
655 |
def testParamsNone(self): |
|
656 |
self.assertRaises(errors.ProgrammerError, backend._CheckStorageParams, |
|
657 |
None, NotImplemented) |
|
658 |
|
|
659 |
def testParamsWrongType(self): |
|
660 |
self.assertRaises(errors.ProgrammerError, backend._CheckStorageParams, |
|
661 |
"string", NotImplemented) |
|
662 |
|
|
663 |
def testParamsEmpty(self): |
|
664 |
backend._CheckStorageParams([], 0) |
|
665 |
|
|
666 |
def testParamsValidNumber(self): |
|
667 |
backend._CheckStorageParams(["a", True], 2) |
|
668 |
|
|
669 |
def testParamsInvalidNumber(self): |
|
670 |
self.assertRaises(errors.ProgrammerError, backend._CheckStorageParams, |
|
671 |
["b", False], 3) |
|
672 |
|
|
673 |
|
|
653 | 674 |
class TestGetNodeInfo(unittest.TestCase): |
654 | 675 |
|
655 | 676 |
_SOME_RESULT = None |
Also available in: Unified diff