benoit@29: import unittest benoit@29: benoit@29: from datetime import datetime benoit@29: benoit@29: from farolluz.cvrf import CVRF, CVRFPublisher, CVRFTracking, CVRFTrackingID, CVRFRevision, ValidationError benoit@29: benoit@29: def minimalDoc(): benoit@29: """ create a minimal valid document """ benoit@29: doc = CVRF('title', 'type') benoit@29: doc.setPublisher(CVRFPublisher('Other')) benoit@29: initial = datetime.now() benoit@29: current = datetime.now() benoit@29: track = CVRFTracking(CVRFTrackingID('1234'), 'Draft', (0,0), initial, current) benoit@29: track.addRevision(CVRFRevision((0,0), current, '1st')) benoit@29: doc.setTracking(track) benoit@29: return doc benoit@29: benoit@29: class TestCase(unittest.TestCase): benoit@29: benoit@29: benoit@29: def _validate(self): benoit@29: try: self.doc.validate() benoit@29: except ValidationError as e: self.fail(e) benoit@29: benoit@29: def setUp(self): benoit@29: self.doc = minimalDoc() benoit@29: self._validate() benoit@29: