Passed
Push — master ( 93cb7b...d45541 )
by
unknown
05:06 queued 24s
created

tests.unit_tests.test_debug_settings   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 130
Duplicated Lines 0 %

Importance

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