Mercurial > farol > farolluz
comparison tests/testGroupIdRename.py @ 31:1ea1a3c3c790
Add method to change a Group ID
author | Benoît Allard <benoit.allard@greenbone.net> |
---|---|
date | Mon, 27 Oct 2014 12:29:56 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
30:b15022ae484a | 31:1ea1a3c3c790 |
---|---|
1 from datetime import datetime | |
2 | |
3 from tests.utils import TestCase | |
4 from farolluz.cvrf import CVRFFullProductName, CVRFGroup, CVRFVulnerability, CVRFThreat | |
5 | |
6 class TestGroupIdRename(TestCase): | |
7 | |
8 def testChangeGroupId(self): | |
9 ptree = self.doc.createProductTree() | |
10 prod1 = CVRFFullProductName('1', 'a', ptree) | |
11 ptree.addProduct(prod1) | |
12 prod2 = CVRFFullProductName('2', 'b', ptree) | |
13 ptree.addProduct(prod2) | |
14 grp = CVRFGroup('GRP-1') | |
15 grp.addProductID('1') | |
16 grp.addProductID('2') | |
17 ptree.addGroup(grp) | |
18 vuln = CVRFVulnerability(1) | |
19 th = CVRFThreat('Impact', 'bad !') | |
20 th.addGroupID('GRP-1') | |
21 vuln.addThreat(th) | |
22 self.doc.addVulnerability(vuln) | |
23 self._validate() | |
24 grp._productid = 'GRP-2' | |
25 self.doc.changeProductID('GRP-1', 'GRP-2') | |
26 self._validate() | |
27 |