view tests/testProductIdRename.py @ 29:e3ee542a89be

Refactor tests dir
author Benoît Allard <benoit.allard@greenbone.net>
date Mon, 27 Oct 2014 11:48:42 +0100
parents 4004b67216a9
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)