[CMF-checkins] CVS: CMF/CMFStaging/tests - testStaging.py:1.11
Shane Hathaway
shane at zope.com
Fri Mar 19 17:10:57 EST 2004
Update of /cvs-repository/CMF/CMFStaging/tests
In directory cvs.zope.org:/tmp/cvs-serv30359/tests
Modified Files:
testStaging.py
Log Message:
Added tests of getObjectStages().
Also made getObjectStages() return an empty list when no stages exist.
=== CMF/CMFStaging/tests/testStaging.py 1.10 => 1.11 ===
--- CMF/CMFStaging/tests/testStaging.py:1.10 Mon Oct 27 15:21:54 2003
+++ CMF/CMFStaging/tests/testStaging.py Fri Mar 19 17:10:56 2004
@@ -229,6 +229,43 @@
self.assertEqual(versions['dev'], versions['review'])
self.assertEqual(versions['dev'], versions['prod'])
+ def testGetObjectStats(self):
+ st = self.root.portal_staging
+ st.updateStages2(self.dev_stage.c1, ['review'])
+ all_stats = st.getObjectStats(self.dev_stage.c1)
+ expect_stats = (
+ {'exists': True,
+ 'is_source': True,
+ 'name': 'dev',
+ 'revision': '1',
+ 'stageable': False,
+ 'title': 'Development',
+ 'url': 'testroot/Stages/Development/c1'},
+ {'exists': True,
+ 'is_source': False,
+ 'name': 'review',
+ 'revision': '1',
+ 'stageable': False,
+ 'title': 'Review',
+ 'url': 'testroot/Stages/Review/c1'},
+ {'exists': False,
+ 'is_source': False,
+ 'name': 'prod',
+ 'object': None,
+ 'revision': None,
+ 'stageable': True,
+ 'title': 'Production',
+ 'url': None})
+ for got, expect in zip(all_stats, expect_stats):
+ for k in expect.keys():
+ self.assertEqual(got[k], expect[k])
+
+ def testGetObjectStatsWithoutStages(self):
+ # getObjectStats() should return an empty list
+ # when there are no stages.
+ st = self.root.portal_staging
+ st._stages = ()
+ self.assertEqual(st.getObjectStats(self.dev_stage.c1), [])
def test_suite():
More information about the CMF-checkins
mailing list