comparison test/test_status.py @ 40:c544903eeced

Add real enums for status information
author Bernhard Herzog <bh@intevation.de>
date Thu, 15 Mar 2007 21:03:44 +0100
parents 086c68ca51d2
children 3c5ab7a65384
comparison
equal deleted inserted replaced
39:17756cdce844 40:c544903eeced
9 9
10 import os 10 import os
11 import unittest 11 import unittest
12 from datetime import datetime 12 from datetime import datetime
13 13
14 from treepkg.status import RevisionStatus 14 from treepkg.status import RevisionStatus, Status, EnumFieldDesc
15 from treepkg.util import ensure_directory, writefile 15 from treepkg.util import ensure_directory, writefile
16 16
17 17
18 18
19 class TestStatus(unittest.TestCase): 19 class TestStatus(unittest.TestCase):
60 60
61 def test_magic(self): 61 def test_magic(self):
62 writefile(self.filename, 62 writefile(self.filename,
63 "Some other magic\nstart: 2007-03-09 17:32:55\n") 63 "Some other magic\nstart: 2007-03-09 17:32:55\n")
64 self.assertRaises(ValueError, RevisionStatus, self.filename) 64 self.assertRaises(ValueError, RevisionStatus, self.filename)
65
66 def test_status_enum(self):
67
68 class TestStatus(Status):
69 status = EnumFieldDesc()
70 status.add("not_running", "Process is not running",
71 default=True)
72 status.add("running", "Process is running")
73 status.add("error", "An error occurred")
74
75 status = TestStatus(self.filename)
76 status.running()
77
78 otherstatus = TestStatus(self.filename)
79 self.assertEquals(otherstatus.status.name, "running")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)