Test Failed
Push — master ( ad184d...ba033d )
by Milan
01:39 queued 15s
created

test_checks.test_is_cce_value_valid()   A

Complexity

Conditions 1

Size

Total Lines 7
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nop 0
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
import os
2
3
import pytest
4
5
import ssg.checks
6
7
8
def test_get_oval_path():
9
    rule_obj = {
10
        'id': 'some_id',
11
        'dir': '/some/random/path/to/a/rule/called/some_id',
12
        'ovals': {
13
            'shared.xml': {}
14
        }
15
    }
16
    correct_path = os.path.join(rule_obj['dir'], "oval", "shared.xml")
17
18
    assert ssg.checks.get_oval_path(rule_obj, "shared") == correct_path
19
    assert ssg.checks.get_oval_path(rule_obj, "shared.xml") == correct_path
20
21
    with pytest.raises(ValueError):
22
        ssg.checks.get_oval_path(rule_obj, "missing")
23
24
    with pytest.raises(ValueError):
25
        ssg.checks.get_oval_path({'id': 'something'}, "missing_dir")
26
27
    with pytest.raises(ValueError):
28
        ssg.checks.get_oval_path({}, "missing_id")
29
30
    with pytest.raises(ValueError):
31
        ssg.checks.get_oval_path({'id': 'present', 'dir': '/'},
32
                                 "missing_ovals")
33