comparison 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
comparison
equal deleted inserted replaced
28:e317097af486 29:e3ee542a89be
1 import unittest
2
3 from datetime import datetime
4
5 from farolluz.cvrf import CVRF, CVRFPublisher, CVRFTracking, CVRFTrackingID, CVRFRevision, ValidationError
6
7 def minimalDoc():
8 """ create a minimal valid document """
9 doc = CVRF('title', 'type')
10 doc.setPublisher(CVRFPublisher('Other'))
11 initial = datetime.now()
12 current = datetime.now()
13 track = CVRFTracking(CVRFTrackingID('1234'), 'Draft', (0,0), initial, current)
14 track.addRevision(CVRFRevision((0,0), current, '1st'))
15 doc.setTracking(track)
16 return doc
17
18 class TestCase(unittest.TestCase):
19
20
21 def _validate(self):
22 try: self.doc.validate()
23 except ValidationError as e: self.fail(e)
24
25 def setUp(self):
26 self.doc = minimalDoc()
27 self._validate()
28
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)