view tests/utils.py @ 35:a94fd33db44a

Added tag 1.0 for changeset 9ddfd6ee6b01
author Benoît Allard <benoit.allard@greenbone.net>
date Wed, 05 Nov 2014 08:54:53 +0100
parents e3ee542a89be
children
line wrap: on
line source
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)