diff 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
line wrap: on
line diff
--- a/test/test_status.py	Thu Mar 15 13:00:01 2007 +0100
+++ b/test/test_status.py	Thu Mar 15 21:03:44 2007 +0100
@@ -11,7 +11,7 @@
 import unittest
 from datetime import datetime
 
-from treepkg.status import RevisionStatus
+from treepkg.status import RevisionStatus, Status, EnumFieldDesc
 from treepkg.util import ensure_directory, writefile
 
 
@@ -62,3 +62,18 @@
         writefile(self.filename,
                   "Some other magic\nstart: 2007-03-09 17:32:55\n")
         self.assertRaises(ValueError, RevisionStatus, self.filename)
+
+    def test_status_enum(self):
+
+        class TestStatus(Status):
+            status = EnumFieldDesc()
+            status.add("not_running", "Process is not running",
+                       default=True)
+            status.add("running", "Process is running")
+            status.add("error", "An error occurred")
+
+        status = TestStatus(self.filename)
+        status.running()
+
+        otherstatus = TestStatus(self.filename)
+        self.assertEquals(otherstatus.status.name, "running")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)