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

10 statements  

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

1"""6.1.15 Translator 

2 

3It must be tested that /document/source_lang is present and set if the value translator is used 

4for /document/publisher/category. 

5 

6The relevant path for this test is: 

7 

8 /document/source_lang 

9 

10Example 54 which fails the test: 

11 

12 "document": { 

13 // ... 

14 "publisher": { 

15 "category": "translator", 

16 "name": "CSAF TC Translator", 

17 "namespace": "https://csaf.io/translator" 

18 }, 

19 "title": "Mandatory test: Translator (failing example 1)", 

20 // ... 

21 } 

22 

23The required element source_lang is missing. 

24""" 

25 

26ID = (6, 1, 15) 

27TOPIC = 'Translator' 

28BASE_URL = 'https://docs.oasis-open.org/csaf/csaf/v2.0/cs01/csaf-v2.0-cs01.html' 

29REFERENCE = f'{BASE_URL}#6115-translator' 

30TRIGGER_PATH = '/document/publisher/category' 

31TRIGGER_JMES_PATH = TRIGGER_PATH.lstrip('/').replace('/', '.') 

32TRIGGER_VALUE = 'translator' 

33CONDITION_PATH = '/document/source_lang' 

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

35PATHS = (CONDITION_PATH,)