Revision c9c4f19e test/ganeti.utils_unittest.py
b/test/ganeti.utils_unittest.py | ||
---|---|---|
33 | 33 |
import re |
34 | 34 |
|
35 | 35 |
import ganeti |
36 |
import testutils |
|
36 | 37 |
from ganeti import constants |
37 | 38 |
from ganeti import utils |
38 | 39 |
from ganeti.utils import IsProcessAlive, Lock, Unlock, RunCmd, \ |
... | ... | |
43 | 44 |
from ganeti.errors import LockError, UnitParseError |
44 | 45 |
|
45 | 46 |
|
46 |
class GanetiTestCase(unittest.TestCase): |
|
47 |
def assertFileContent(self, file_name, content): |
|
48 |
"""Checks the content of a file. |
|
49 |
|
|
50 |
""" |
|
51 |
handle = open(file_name, 'r') |
|
52 |
try: |
|
53 |
self.assertEqual(handle.read(), content) |
|
54 |
finally: |
|
55 |
handle.close() |
|
56 |
|
|
57 |
|
|
58 | 47 |
class TestIsProcessAlive(unittest.TestCase): |
59 | 48 |
"""Testing case for IsProcessAlive""" |
60 | 49 |
def setUp(self): |
... | ... | |
362 | 351 |
self.assertRaises(UnitParseError, ParseUnit, '1,3' + suffix) |
363 | 352 |
|
364 | 353 |
|
365 |
class TestSshKeys(GanetiTestCase): |
|
354 |
class TestSshKeys(testutils.GanetiTestCase):
|
|
366 | 355 |
"""Test case for the AddAuthorizedKey function""" |
367 | 356 |
|
368 | 357 |
KEY_A = 'ssh-dss AAAAB3NzaC1w5256closdj32mZaQU root@key-a' |
... | ... | |
432 | 421 |
" ssh-dss AAAAB3NzaC1w520smc01ms0jfJs22 root@key-b\n") |
433 | 422 |
|
434 | 423 |
|
435 |
class TestEtcHosts(GanetiTestCase): |
|
424 |
class TestEtcHosts(testutils.GanetiTestCase):
|
|
436 | 425 |
"""Test functions modifying /etc/hosts""" |
437 | 426 |
|
438 | 427 |
def setUp(self): |
Also available in: Unified diff