Coverage for turvallisuusneuvonta/csaf/core/rules/mandatory/unique_group_ids.py: 100.00%

5 statements  

« prev     ^ index     » next       coverage.py v7.4.1, created at 2024-02-05 19:27:17 +00:00

1"""6.1.5 Multiple Definition of Product Group ID 

2 

3For each Product Group ID (type /$defs/product_group_id_t) Product Group elements (/product_tree/product_groups[]) 

4it must be tested that the group_id was not already defined within the same document. 

5 

6The relevant path for this test is: 

7 

8 /product_tree/product_groups[]/group_id 

9 

10Example 44 which fails the test: 

11 

12 "product_tree": { 

13 "full_product_names": [ 

14 { 

15 "product_id": "CSAFPID-9080700", 

16 "name": "Product A" 

17 }, 

18 { 

19 "product_id": "CSAFPID-9080701", 

20 "name": "Product B" 

21 }, 

22 { 

23 "product_id": "CSAFPID-9080702", 

24 "name": "Product C" 

25 } 

26 ], 

27 "product_groups": [ 

28 { 

29 "group_id": "CSAFGID-1020300", 

30 "product_ids": [ 

31 "CSAFPID-9080700", 

32 "CSAFPID-9080701" 

33 ] 

34 }, 

35 { 

36 "group_id": "CSAFGID-1020300", 

37 "product_ids": [ 

38 "CSAFPID-9080700", 

39 "CSAFPID-9080702" 

40 ] 

41 } 

42 ] 

43 } 

44 

45CSAFGID-1020300 was defined twice. 

46""" 

47 

48ID = (6, 1, 5) 

49TOPIC = 'Multiple Definition of Product Group ID' 

50CONDITION_PATH = '/product_tree/product_groups[]/group_id' 

51CONDITION_JMES_PATH = CONDITION_PATH.lstrip('/').replace('/', '.') 

52PATHS = (CONDITION_PATH,)