view tests/testProductIdRename.py @ 36:cb8e8416a765

Add HTML export format.
author Benoît Allard <benoit.allard@greenbone.net>
date Tue, 16 Dec 2014 16:20:50 +0100
parents e3ee542a89be
children
line wrap: on
line source
from datetime import datetime

from tests.utils import TestCase
from farolluz.cvrf import CVRFFullProductName, CVRFVulnerability, CVRFProductStatus, CVRFRelationship

class TestProductIdRename(TestCase):

    def testChangeProductId(self):
        ptree = self.doc.createProductTree()
        prod = CVRFFullProductName('1', 'a', ptree)
        ptree.addProduct(prod)
        vuln = CVRFVulnerability(1)
        st = CVRFProductStatus('Fixed')
        st.addProductID('1')
        vuln.addProductStatus(st)
        self.doc.addVulnerability(vuln)
        self._validate()
        prod._productid = '2'
        self.doc.changeProductID('1', '2')
        self._validate()

    def testChangeProductIdRelation(self):
        ptree = self.doc.createProductTree()
        prod1 = CVRFFullProductName('1', 'a', ptree)
        ptree.addProduct(prod1)
        prod2 = CVRFFullProductName('2', 'b', ptree)
        ptree.addProduct(prod2)
        rel = CVRFRelationship('1', 'Installed On', '2')
        ptree.addRelationship(rel)
        self._validate()
        prod1._productid = '3'
        self.doc.changeProductID('1', '3')
        self.doc.validate()
        prod2._productid = '1'
        self.doc.changeProductID('2', '1')
        self._validate()
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)