Revision 26a72a48 test/ganeti.cli_unittest.py
b/test/ganeti.cli_unittest.py | ||
---|---|---|
22 | 22 |
"""Script for unittesting the cli module""" |
23 | 23 |
|
24 | 24 |
import unittest |
25 |
import time |
|
25 | 26 |
from cStringIO import StringIO |
26 | 27 |
|
27 | 28 |
import ganeti |
... | ... | |
908 | 909 |
self.assertEqual(cl.CountPending(), 0) |
909 | 910 |
|
910 | 911 |
|
912 |
class TestFormatTimestamp(unittest.TestCase): |
|
913 |
def testGood(self): |
|
914 |
self.assertEqual(cli.FormatTimestamp((0, 1)), |
|
915 |
time.strftime("%F %T", time.localtime(0)) + ".000001") |
|
916 |
self.assertEqual(cli.FormatTimestamp((1332944009, 17376)), |
|
917 |
(time.strftime("%F %T", time.localtime(1332944009)) + |
|
918 |
".017376")) |
|
919 |
|
|
920 |
def testWrong(self): |
|
921 |
for i in [0, [], {}, "", [1]]: |
|
922 |
self.assertEqual(cli.FormatTimestamp(i), "?") |
|
923 |
|
|
924 |
|
|
911 | 925 |
if __name__ == '__main__': |
912 | 926 |
testutils.GanetiTestProgram() |
Also available in: Unified diff