Index: server/test/server/job.py
===================================================================
--- server/test/server/job.py	(revision 345c4768c17a73ba2749c01a590747645f06393f)
+++ server/test/server/job.py	(revision 951ab1bdfe4dd0ee569e0d9fdad9d257eac7623b)
@@ -4,4 +4,5 @@
 import unittest
 import tempfile
+import sys
 
 def make_tempfile():
@@ -37,19 +38,12 @@
         self.assertFalse(self.job.is_paused)
         self.assertFalse(self.job.is_done)
+        self.assertFalse(self.job.is_completed)
+        self.assertFalse(self.job.is_cancelled)
+        self.assertFalse(self.job.is_aborted)
 
     def testSpool(self):
-        fh = make_tempfile()
-        # This should fail, because the id hasn't been set
-        self.assertFalse(self.job.is_valid)
-        self.job.id = 1
-        self.assertTrue(self.job.is_valid)
-        self.assertFalse(self.job.is_ready)
-        self.job.spool(fh)
-        self.assertEqual(self.job.document, fh.name)
-        self.assertNotEqual(self.job.player, None)
-        self.assertEqual(self.job.creator, "")
-        self.assertEqual(self.job.state, States.PENDING)
-        self.assertTrue(self.job.is_ready)
-        self.job.abort()
+        fh = tempfile.NamedTemporaryFile()
+        self.assertRaises(errors.InvalidJobStateException, self.job.spool, fh)
+        fh.close()
     def testPlay(self):
         self.assertRaises(errors.InvalidJobStateException, self.job.play)
@@ -58,7 +52,9 @@
     def testCancel(self):
         self.job.cancel()
+        self.assertTrue(self.job.is_cancelled)
         self.assertEqual(self.job.state, States.CANCELLED)
     def testAbort(self):
         self.job.abort()
+        self.assertTrue(self.job.is_aborted)
         self.assertEqual(self.job.state, States.ABORTED)
 
@@ -66,24 +62,75 @@
 
     def testBadJobId(self):
-        self.job = GutenbachJob(job_id=-2)
-        self.assertEqual(self.job.id, -1)
-        self.job.id = -2
-        self.assertEqual(self.job.id, -1)
+        job = GutenbachJob(job_id=-2)
+        self.assertEqual(job.id, -1)
+        job.id = -2
+        self.assertEqual(job.id, -1)
 
     def testBadCreator(self):
-        self.job = GutenbachJob(job_id=1, creator=12345)
-        self.assertEqual(self.job.creator, "12345")
-        self.job.creator = None
-        self.assertEqual(self.job.creator, "")
-        self.job.creator = []
-        self.assertEqual(self.job.creator, "[]")
+        job = GutenbachJob(
+            job_id=1,
+            creator=12345)
+        self.assertEqual(job.creator, "12345")
+        job.creator = None
+        self.assertEqual(job.creator, "")
+        job.creator = []
+        self.assertEqual(job.creator, "[]")
 
     def testBadName(self):
-        self.job = GutenbachJob(job_id=1, creator="foo", name=12345)
-        self.assertEqual(self.job.name, "12345")
-        self.job.name = None
-        self.assertEqual(self.job.name, "")
-        self.job.name = []
-        self.assertEqual(self.job.name, "[]")
+        job = GutenbachJob(
+            job_id=1,
+            creator="foo",
+            name=12345)
+        self.assertEqual(job.name, "12345")
+        job.name = None
+        self.assertEqual(job.name, "")
+        job.name = []
+        self.assertEqual(job.name, "[]")
+
+    def testBadPriority(self):
+        job = GutenbachJob(
+            job_id=1,
+            creator="foo",
+            name="test",
+            priority=-1)
+        self.assertEqual(job.priority, 1)
+        job.priority = 0
+        self.assertEqual(job.priority, 1)
+        job.priority = 1
+        self.assertEqual(job.priority, 1)
+        job.priority = sys.maxint
+        self.assertEqual(job.priority, sys.maxint)
+        job.priority = "hello"
+        self.assertEqual(job.priority, 1)
+        job.priority = []
+        self.assertEqual(job.priority, 1)
+
+    def testBadDocument(self):
+        job = GutenbachJob(
+            job_id=1,
+            creator="foo",
+            name="test",
+            priority=1)
+        self.assertRaises(errors.InvalidDocument, job.spool, "hello")
+        
+class TestGoodGutenbachJob(unittest.TestCase):
+
+    def setUp(self):
+        self.job = GutenbachJob(job_id=1, creator="foo", name="test")
+
+    def testSpool(self):
+        fh = make_tempfile()
+        self.assertTrue(self.job.is_valid)
+        self.assertFalse(self.job.is_ready)
+        self.job.spool(fh)
+        self.assertTrue(self.job.is_ready)
+        
+        # Verify various properties
+        self.assertEqual(self.job.document, fh.name)
+        self.assertNotEqual(self.job.player, None)
+        self.assertEqual(self.job.state, States.PENDING)
+
+        self.job.abort()
+
 
 if __name__ == "__main__":
