tests.unit_tests.test_debug_settings   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 131
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 93
dl 0
loc 131
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 122 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.unit_test
10
@pytest.mark.parametrize("debug_flags, expected_values", [
11
    (
12
        [
13
            "NO-MINIFY",
14
            "BUTTON-SHOW-ALL-RULES",
15
            "ONLINE-CSS",
16
            "BUTTON-SHOW-ALL-RULES-AND-OVAL-TEST-DETAILS"
17
        ],
18
        DebugSetting(
19
            no_minify=True,
20
            include_debug_script=True,
21
            button_show_all_rules=True,
22
            use_online_css=True,
23
            button_show_all_rules_and_oval_test_details=True
24
        )
25
    ),
26
    (
27
        [
28
            "BUTTON-SHOW-ALL-RULES",
29
            "ONLINE-CSS",
30
            "BUTTON-SHOW-ALL-RULES-AND-OVAL-TEST-DETAILS"
31
        ],
32
        DebugSetting(
33
            include_debug_script=True,
34
            button_show_all_rules=True,
35
            use_online_css=True,
36
            button_show_all_rules_and_oval_test_details=True
37
        )
38
    ),
39
    (
40
        [
41
            "NO-MINIFY",
42
            "ONLINE-CSS",
43
            "BUTTON-SHOW-ALL-RULES-AND-OVAL-TEST-DETAILS"
44
        ],
45
        DebugSetting(
46
            no_minify=True,
47
            include_debug_script=True,
48
            use_online_css=True,
49
            button_show_all_rules_and_oval_test_details=True
50
        )
51
    ),
52
    (
53
        [
54
            "NO-MINIFY",
55
            "BUTTON-SHOW-ALL-RULES",
56
            "BUTTON-SHOW-ALL-RULES-AND-OVAL-TEST-DETAILS"
57
        ],
58
        DebugSetting(
59
            no_minify=True,
60
            include_debug_script=True,
61
            button_show_all_rules=True,
62
            button_show_all_rules_and_oval_test_details=True
63
        )
64
    ),
65
    (
66
        [
67
            "NO-MINIFY",
68
            "BUTTON-SHOW-ALL-RULES",
69
            "ONLINE-CSS",
70
        ],
71
        DebugSetting(
72
            no_minify=True,
73
            include_debug_script=True,
74
            button_show_all_rules=True,
75
            use_online_css=True,
76
        )
77
    ),
78
    (
79
        [
80
            "NO-MINIFY",
81
            "ONLINE-CSS",
82
        ],
83
        DebugSetting(
84
            no_minify=True,
85
            use_online_css=True,
86
        )
87
    ),
88
    (
89
        [
90
            "NO-MINIFY",
91
        ],
92
        DebugSetting(
93
            no_minify=True,
94
        )
95
    ),
96
    (
97
        [
98
            "BUTTON-SHOW-ALL-RULES",
99
        ],
100
        DebugSetting(
101
            include_debug_script=True,
102
            button_show_all_rules=True,
103
        )
104
    ),
105
    (
106
        [
107
            "ONLINE-CSS",
108
        ],
109
        DebugSetting(
110
            use_online_css=True,
111
        )
112
    ),
113
    (
114
        [
115
            "BUTTON-SHOW-ALL-RULES-AND-OVAL-TEST-DETAILS"
116
        ],
117
        DebugSetting(
118
            include_debug_script=True,
119
            button_show_all_rules_and_oval_test_details=True
120
        )
121
    ),
122
    (
123
        [],
124
        DebugSetting()
125
    ),
126
])
127
def test_update_settings_with_debug_flags(debug_flags, expected_values):
128
    debug_settings = DebugSetting()
129
    debug_settings.update_settings_with_debug_flags(debug_flags)
130
    assert expected_values == debug_settings
131