tests_oval_graph.test_commands.test_command_line_client.test_client   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 6
eloc 20
dl 0
loc 28
rs 10
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A get_client() 0 6 2
A test_search_rules_id_not_implemented_error() 0 5 2
A test_get_only_fail_rules_not_implemented_error() 0 5 2
1
import pytest
2
3
from oval_graph.command_line_client.client import Client
4
5
from .constants_for_tests import PATH_TO_ARF_REPORT
6
7
8
def get_client(rule, optional_args=None):
9
    path = str(PATH_TO_ARF_REPORT)
10
    args = [path, rule]
11
    if optional_args is not None:
12
        args.extend(optional_args)
13
    return Client(args)
14
15
16
def test_search_rules_id_not_implemented_error():
17
    part_of_id_rule = 'xccdf_org.ssgproject.'
18
    client = get_client(part_of_id_rule)
19
    with pytest.raises(NotImplementedError):
20
        assert client.search_rules_id()
21
22
23
def test_get_only_fail_rules_not_implemented_error():
24
    part_of_id_rule = 'xccdf_org.ssgproject.'
25
    client = get_client(part_of_id_rule)
26
    with pytest.raises(NotImplementedError):
27
        assert client.get_only_fail_rule(['rule-id'])
28