diff tests/utils.py @ 29:e3ee542a89be

Refactor tests dir
author Benoît Allard <benoit.allard@greenbone.net>
date Mon, 27 Oct 2014 11:48:42 +0100
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/utils.py	Mon Oct 27 11:48:42 2014 +0100
@@ -0,0 +1,28 @@
+import unittest
+
+from datetime import datetime
+
+from farolluz.cvrf import CVRF, CVRFPublisher, CVRFTracking, CVRFTrackingID, CVRFRevision, ValidationError
+
+def minimalDoc():
+    """ create a minimal valid document """
+    doc = CVRF('title', 'type')
+    doc.setPublisher(CVRFPublisher('Other'))
+    initial = datetime.now()
+    current = datetime.now()
+    track = CVRFTracking(CVRFTrackingID('1234'), 'Draft', (0,0), initial, current)
+    track.addRevision(CVRFRevision((0,0), current, '1st'))
+    doc.setTracking(track)
+    return doc
+
+class TestCase(unittest.TestCase):
+
+
+    def _validate(self):
+        try: self.doc.validate()
+        except ValidationError as e: self.fail(e)
+
+    def setUp(self):
+        self.doc = minimalDoc()
+        self._validate()
+
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)