view tests/testProductIdRename.py @ 33:bd2ae8de33c1

Add a .hgignore
author Benoît Allard <benoit.allard@greenbone.net>
date Tue, 04 Nov 2014 16:21:04 +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)