Passed
Pull Request — master (#92)
by Jan
05:32
created

tests.unit_tests.test_debug_settings   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 80
dl 0
loc 97
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
B test_update_settings_with_debug_flags() 0 88 1
1
# Copyright 2022, Red Hat, Inc.
2
# SPDX-License-Identifier: LGPL-2.1-or-later
3
4
import pytest
5
6
from openscap_report.debug_settings import DebugSetting
7
8
9
@pytest.mark.parametrize("debug_flags, expected_values", [
10
    ([
11
        "NO-MINIFY",
12
        "BUTTON-SHOW-ALL-RULES",
13
        "ONLINE-CSS",
14
        "BUTTON-SHOW-ALL-RULES-AND-OVAL-TEST-DETAILS"
15
    ], DebugSetting(
16
        no_minify=True,
17
        include_debug_script=True,
18
        button_show_all_rules=True,
19
        use_online_css=True,
20
        button_show_all_rules_and_oval_test_details=True
21
    )),
22
    ([
23
        "BUTTON-SHOW-ALL-RULES",
24
        "ONLINE-CSS",
25
        "BUTTON-SHOW-ALL-RULES-AND-OVAL-TEST-DETAILS"
26
    ], DebugSetting(
27
        include_debug_script=True,
28
        button_show_all_rules=True,
29
        use_online_css=True,
30
        button_show_all_rules_and_oval_test_details=True
31
    )),
32
    ([
33
        "NO-MINIFY",
34
        "ONLINE-CSS",
35
        "BUTTON-SHOW-ALL-RULES-AND-OVAL-TEST-DETAILS"
36
    ], DebugSetting(
37
        no_minify=True,
38
        include_debug_script=True,
39
        use_online_css=True,
40
        button_show_all_rules_and_oval_test_details=True
41
    )),
42
    ([
43
        "NO-MINIFY",
44
        "BUTTON-SHOW-ALL-RULES",
45
        "BUTTON-SHOW-ALL-RULES-AND-OVAL-TEST-DETAILS"
46
    ], DebugSetting(
47
        no_minify=True,
48
        include_debug_script=True,
49
        button_show_all_rules=True,
50
        button_show_all_rules_and_oval_test_details=True
51
    )),
52
    ([
53
        "NO-MINIFY",
54
        "BUTTON-SHOW-ALL-RULES",
55
        "ONLINE-CSS",
56
    ], DebugSetting(
57
        no_minify=True,
58
        include_debug_script=True,
59
        button_show_all_rules=True,
60
        use_online_css=True,
61
    )),
62
    ([
63
        "NO-MINIFY",
64
        "ONLINE-CSS",
65
    ], DebugSetting(
66
        no_minify=True,
67
        use_online_css=True,
68
    )),
69
    ([
70
        "NO-MINIFY",
71
    ], DebugSetting(
72
        no_minify=True,
73
    )),
74
    ([
75
        "BUTTON-SHOW-ALL-RULES",
76
    ], DebugSetting(
77
        include_debug_script=True,
78
        button_show_all_rules=True,
79
    )),
80
    ([
81
        "ONLINE-CSS",
82
    ], DebugSetting(
83
        use_online_css=True,
84
    )),
85
    ([
86
        "BUTTON-SHOW-ALL-RULES-AND-OVAL-TEST-DETAILS"
87
    ], DebugSetting(
88
        include_debug_script=True,
89
        button_show_all_rules_and_oval_test_details=True
90
    )),
91
    ([], DebugSetting()),
92
])
93
def test_update_settings_with_debug_flags(debug_flags, expected_values):
94
    debug_settings = DebugSetting()
95
    debug_settings.update_settings_with_debug_flags(debug_flags)
96
    assert expected_values == debug_settings
97