Revision da961187 test/ganeti.utils_unittest.py
b/test/ganeti.utils_unittest.py | ||
---|---|---|
44 | 44 |
ParseUnit, AddAuthorizedKey, RemoveAuthorizedKey, \ |
45 | 45 |
ShellQuote, ShellQuoteArgs, TcpPing, ListVisibleFiles, \ |
46 | 46 |
SetEtcHostsEntry, RemoveEtcHostsEntry, FirstFree, OwnIpAddress, \ |
47 |
TailFile, ForceDictType |
|
47 |
TailFile, ForceDictType, IsNormAbsPath
|
|
48 | 48 |
|
49 | 49 |
from ganeti.errors import LockError, UnitParseError, GenericError, \ |
50 | 50 |
ProgrammerError |
... | ... | |
969 | 969 |
self.assertRaises(errors.TypeEnforcementError, self._fdt, {'d': '4 L'}) |
970 | 970 |
|
971 | 971 |
|
972 |
class TestIsAbsNormPath(unittest.TestCase): |
|
973 |
"""Testing case for IsProcessAlive""" |
|
974 |
|
|
975 |
def _pathTestHelper(self, path, result): |
|
976 |
if result: |
|
977 |
self.assert_(IsNormAbsPath(path), |
|
978 |
"Path %s should be absolute and normal" % path) |
|
979 |
else: |
|
980 |
self.assert_(not IsNormAbsPath(path), |
|
981 |
"Path %s should not be absolute and normal" % path) |
|
982 |
|
|
983 |
def testBase(self): |
|
984 |
self._pathTestHelper('/etc', True) |
|
985 |
self._pathTestHelper('/srv', True) |
|
986 |
self._pathTestHelper('etc', False) |
|
987 |
self._pathTestHelper('/etc/../root', False) |
|
988 |
self._pathTestHelper('/etc/', False) |
|
989 |
|
|
972 | 990 |
if __name__ == '__main__': |
973 | 991 |
unittest.main() |
Also available in: Unified diff