[Zope-CVS] CVS: Packages/JobBoardEx/tests - testJob.py:1.4
Fred L. Drake, Jr.
fdrake@acm.org
Wed, 20 Mar 2002 12:39:57 -0500
Update of /cvs-repository/Packages/JobBoardEx/tests
In directory cvs.zope.org:/tmp/cvs-serv25069/tests
Modified Files:
testJob.py
Log Message:
Do not assume that an ID will be availble when a Job is first created,
but make sure it can be set at most once.
=== Packages/JobBoardEx/tests/testJob.py 1.3 => 1.4 ===
def setUp(self):
self.job = Job("submitter", "summary", "description",
- "contactURL", "contactEmail", "id")
+ "contactURL", "contactEmail")
def test_initialization(self):
job = self.job
- self.assertEqual(job.id, "id")
+ self.assertEqual(job.id, None)
self.assertEqual(job.submitter, 'submitter')
self.assertEqual(job.summary, 'summary')
self.assertEqual(job.description, 'description')
@@ -26,6 +26,18 @@
def test_states(self):
self.job.approve()
self.assertEqual(self.job.state, JobState.Approved)
+
+ def test_id_assignment(self):
+ job = self.job
+ job.id = "foo"
+ self.assertEqual(job.id, "foo")
+ try:
+ job.id = "splat"
+ except ValueError:
+ self.assertEqual(job.id, "foo")
+ else:
+ self.fail("expected id not to be changeable")
+
def test_suite():
return unittest.TestSuite((unittest.makeSuite(JobTestCase),))