benoit@22: from datetime import datetime benoit@22: benoit@29: from tests.utils import TestCase benoit@29: from farolluz.cvrf import CVRFFullProductName, CVRFVulnerability, CVRFProductStatus, CVRFRelationship benoit@22: benoit@29: class TestProductIdRename(TestCase): benoit@22: benoit@22: def testChangeProductId(self): benoit@22: ptree = self.doc.createProductTree() benoit@22: prod = CVRFFullProductName('1', 'a', ptree) benoit@22: ptree.addProduct(prod) benoit@22: vuln = CVRFVulnerability(1) benoit@22: st = CVRFProductStatus('Fixed') benoit@22: st.addProductID('1') benoit@22: vuln.addProductStatus(st) benoit@22: self.doc.addVulnerability(vuln) benoit@29: self._validate() benoit@22: prod._productid = '2' benoit@22: self.doc.changeProductID('1', '2') benoit@29: self._validate() benoit@22: benoit@22: def testChangeProductIdRelation(self): benoit@22: ptree = self.doc.createProductTree() benoit@22: prod1 = CVRFFullProductName('1', 'a', ptree) benoit@22: ptree.addProduct(prod1) benoit@22: prod2 = CVRFFullProductName('2', 'b', ptree) benoit@22: ptree.addProduct(prod2) benoit@22: rel = CVRFRelationship('1', 'Installed On', '2') benoit@22: ptree.addRelationship(rel) benoit@29: self._validate() benoit@22: prod1._productid = '3' benoit@22: self.doc.changeProductID('1', '3') benoit@22: self.doc.validate() benoit@22: prod2._productid = '1' benoit@22: self.doc.changeProductID('2', '1') benoit@29: self._validate()