Passed
Pull Request — master (#161)
by Jan
04:20
created

tests.test_arf_to_json   A

Complexity

Total Complexity 27

Size/Duplication

Total Lines 258
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 164
dl 0
loc 258
rs 10
c 0
b 0
f 0
wmc 27

20 Functions

Rating   Name   Duplication   Size   Complexity  
A test_get_questions_not_selected() 0 6 1
A test_if_file_has_content() 0 6 1
A get_client_arf_to_json_with_define_dest() 0 6 2
A get_client_arf_to_json_with_option_show_not_selected_rules() 0 4 1
A test_creation_json_two_selected_rules() 0 17 2
A test_if_not_installed_inquirer_with_option_show_not_selected_rules() 0 10 2
A test_prepare_json_and_save_in_defined_destination() 0 7 1
A test_prepare_graph_with_non_existent_rule() 0 4 1
A try_expection_for_prepare_graph() 0 5 2
A test_get_questions_with_option_show_failed_rules() 0 5 1
A test_if_not_installed_inquirer_with_option_show_not_selected_rules_and_show_failed_rules() 0 11 2
A test_prepare_graph_with_not_selected_rule() 0 4 1
A get_client_arf_to_json() 0 3 1
A test_if_not_installed_inquirer_with_option_show_failed_rules() 0 9 2
A test_prepare_json() 0 13 1
A test_get_questions_not_selected_and_show_failed_rules() 0 7 1
A test_creation_json_with_two_more_rule() 0 20 2
A test_is_empty_file() 0 6 1
A get_client_arf_to_json_with_option_show_not_selected_rules_and_show_failed_rules() 0 7 1
A get_client_arf_to_json_with_option_show_failed_rules() 0 3 1
1
import pytest
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
introduced by
import missing from __future__ import absolute_import
Loading history...
2
import tempfile
0 ignored issues
show
introduced by
standard import "import tempfile" should be placed before "import pytest"
Loading history...
3
import os
0 ignored issues
show
introduced by
standard import "import os" should be placed before "import pytest"
Loading history...
4
import uuid
0 ignored issues
show
introduced by
standard import "import uuid" should be placed before "import pytest"
Loading history...
5
import json
0 ignored issues
show
introduced by
standard import "import json" should be placed before "import pytest"
Loading history...
6
import mock
7
import sys
0 ignored issues
show
introduced by
standard import "import sys" should be placed before "import pytest"
Loading history...
8
from datetime import datetime
0 ignored issues
show
Unused Code introduced by
Unused datetime imported from datetime
Loading history...
introduced by
standard import "from datetime import datetime" should be placed before "import pytest"
Loading history...
9
import time
0 ignored issues
show
introduced by
standard import "import time" should be placed before "import pytest"
Loading history...
10
11
from oval_graph.arf_to_json import ArfToJson
12
import tests.any_test_help
13
14
15
def get_client_arf_to_json(src, rule):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
16
    return ArfToJson(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
17
        [tests.any_test_help.get_src(src), rule])
18
19
20
def get_client_arf_to_json_with_define_dest(src, rule, out_src=None):
0 ignored issues
show
Coding Style Naming introduced by
Function name "get_client_arf_to_json_with_define_dest" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
21
    out_src = str(uuid.uuid4()) + ".json" if out_src is None else out_src
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
22
    return ArfToJson(["--output",
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
23
                      tests.any_test_help.get_src(os.path.join(tempfile.gettempdir(), out_src)),
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (96/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
24
                      tests.any_test_help.get_src(src),
25
                      rule])
26
27
28
def get_client_arf_to_json_with_option_show_failed_rules(src, rule):
0 ignored issues
show
Coding Style Naming introduced by
Function name "get_client_arf_to_json_with_option_show_failed_rules" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
29
    return ArfToJson(["--show-failed-rules",
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
30
                      tests.any_test_help.get_src(src), rule])
31
32
33
def get_client_arf_to_json_with_option_show_not_selected_rules(src, rule):
0 ignored issues
show
Coding Style Naming introduced by
Function name "get_client_arf_to_json_with_option_show_not_selected_rules" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
34
    return ArfToJson(["--show-not-selected-rules",
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
35
                      tests.any_test_help.get_src(src),
36
                      rule])
37
38
39
def get_client_arf_to_json_with_option_show_not_selected_rules_and_show_failed_rules(
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (85/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Coding Style Naming introduced by
Function name "get_client_arf_to_json_with_option_show_not_selected_rules_and_show_failed_rules" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
40
        src,
41
        rule):
42
    return ArfToJson(["--show-not-selected-rules",
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
43
                      "--show-failed-rules",
44
                      tests.any_test_help.get_src(src),
45
                      rule])
46
47
48
def try_expection_for_prepare_graph(src, rule, err):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
49
    client = get_client_arf_to_json(src, rule)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
50
    rules = {'rules': [rule]}
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
51
    with pytest.raises(Exception, match=err):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
52
        assert client.prepare_data(rules)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
53
54
55
def test_prepare_graph_with_non_existent_rule():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_prepare_graph_with_non_existent_rule" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
56
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
57
    rule = 'non-existent_rule'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
58
    try_expection_for_prepare_graph(src, rule, '404')
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
59
60
61
def test_prepare_graph_with_not_selected_rule():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_prepare_graph_with_not_selected_rule" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
62
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
63
    rule = 'xccdf_org.ssgproject.content_rule_package_nis_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
64
    try_expection_for_prepare_graph(src, rule, 'not selected')
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
65
66
67
def test_prepare_json(capsys):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
68
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
69
    rule = 'xccdf_org.ssgproject.content_rule_package_abrt_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
70
    client = get_client_arf_to_json(src, rule)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
71
    rules = {'rules': [rule]}
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
72
    results_src = client.prepare_data(rules)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
73
    assert not results_src
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
74
    captured = capsys.readouterr()
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
75
    assert captured.out == (
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
76
        '{\n'
77
        '    "graph-of-xccdf_org.ssgproject.content_rule_package_abrt_removed' +
78
        client.date +
79
        '": {\n'
80
        '        "node_id": "xccdf_org.ssgproject.content_rule_package_abrt_removed",\n'
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (88/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
81
        '        "type": "operator",\n'
82
        '        "value": "and",\n'
83
        '        "negation": false,\n'
84
        '        "comment": "Package abrt Removed",\n'
85
        '        "tag": "Rule",\n'
86
        '        "test_result_details": null,\n'
87
        '        "child": [\n'
88
        '            {\n'
89
        '                "node_id": "oval:ssg-package_abrt_removed:def:1",\n'
90
        '                "type": "operator",\n'
91
        '                "value": "and",\n'
92
        '                "negation": false,\n'
93
        '                "comment": "The RPM package abrt should be removed.",\n'
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (81/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
94
        '                "tag": "Definition",\n'
95
        '                "test_result_details": null,\n'
96
        '                "child": [\n'
97
        '                    {\n'
98
        '                        "node_id": "oval:ssg-test_package_abrt_removed:tst:1",\n'
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (90/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
99
        '                        "type": "value",\n'
100
        '                        "value": "false",\n'
101
        '                        "negation": false,\n'
102
        '                        "comment": "package abrt is removed",\n'
103
        '                        "tag": "Test",\n'
104
        '                        "test_result_details": {\n'
105
        '                            "id": "oval:ssg-test_package_abrt_removed:tst:1",\n'
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (89/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
106
        '                            "comment": "package abrt is removed",\n'
107
        '                            "objects": [\n'
108
        '                                {\n'
109
        '                                    "oval:ssg-obj_package_abrt_removed:obj:1":'
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (88/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
110
        ' "complete",\n'
111
        '                                    "rpminfo_object": {\n'
112
        '                                        "name": "abrt",\n'
113
        '                                        "arch": "x86_64",\n'
114
        '                                        "epoch": "(none)",\n'
115
        '                                        "release": "2.fc30",\n'
116
        '                                        "version": "2.12.0",\n'
117
        '                                        "evr": "0:2.12.0-2.fc30",\n'
118
        '                                        "signature_keyid": "ef3c111fcfc659b9",\n'
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (90/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
119
        '                                        "extended_name":'
120
        ' "abrt-0:2.12.0-2.fc30.x86_64"\n'
121
        '                                    }\n'
122
        '                                }\n'
123
        '                            ]\n'
124
        '                        },\n'
125
        '                        "child": null\n'
126
        '                    }\n'
127
        '                ]\n'
128
        '            }\n'
129
        '        ]\n'
130
        '    }\n'
131
        '}\n')
132
133
134
def test_prepare_json_and_save_in_defined_destination():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_prepare_json_and_save_in_defined_destination" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
135
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
136
    rule = 'xccdf_org.ssgproject.content_rule_package_abrt_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
137
    client = get_client_arf_to_json_with_define_dest(src, rule)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
138
    rules = {'rules': [rule]}
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
139
    results_src = client.prepare_data(rules)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
140
    tests.any_test_help.compare_results_json(results_src[0])
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
141
142
143
def test_is_empty_file():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
144
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
145
    rule = 'xccdf_org.ssgproject.content_rule_package_abrt_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
146
    client = get_client_arf_to_json_with_define_dest(src, rule)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
147
    empty_file_src = tests.any_test_help.get_src('test_data/empty_file.json')
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
148
    assert client.file_is_empty(empty_file_src)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
149
150
151
def test_if_file_has_content():
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
152
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
153
    rule = 'xccdf_org.ssgproject.content_rule_package_abrt_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
154
    client = get_client_arf_to_json_with_define_dest(src, rule)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
155
    file_src = tests.any_test_help.get_src('test_data/JsTree_json0.json')
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
156
    assert not client.file_is_empty(file_src)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
157
158
159
def test_creation_json_with_two_more_rule():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_creation_json_with_two_more_rule" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
160
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
161
    rule = 'xccdf_org.ssgproject.content_rule_package_abrt_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
162
    client = get_client_arf_to_json_with_define_dest(src, rule)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
163
    rules = {'rules': [rule]}
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
164
    result_src = client.prepare_data(rules)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
165
    time.sleep(1)  # wait for change time in saved rule name
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
166
    client1 = get_client_arf_to_json_with_define_dest(src, rule, result_src[0])
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
167
    result_src_second_rule = client1.prepare_data(rules)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
168
    assert result_src == result_src_second_rule
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
169
    data = None
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
170
    with open(result_src[-1], 'r') as f:
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Coding Style Naming introduced by
Variable name "f" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
171
        data = json.load(f)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
172
    rules_id = list(data.keys())
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
173
    assert len(rules_id) == 2
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
174
    assert data[rules_id[0]] == data[rules_id[1]]
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
175
    referenc_result = tests.any_test_help.any_get_test_data_json(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
176
        'test_data/referenc_result_data_json.json')
177
    assert referenc_result[
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
178
        "xccdf_org.ssgproject.content_rule_package_abrt_removed"] == data[rules_id[0]]
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (86/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
179
180
181
def test_creation_json_two_selected_rules():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_creation_json_two_selected_rules" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
182
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
183
    rule = 'xccdf_org.ssgproject.content_rule_package_abrt_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
184
    rule1 = 'xccdf_org.ssgproject.content_rule_disable_host_auth'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
185
    client = get_client_arf_to_json_with_define_dest(src, rule)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
186
    rules = {'rules': [rule, rule1]}
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
187
    result_src = client.prepare_data(rules)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
188
    data = None
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
189
    with open(result_src[-1], 'r') as f:
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
Coding Style Naming introduced by
Variable name "f" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
190
        data = json.load(f)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
191
    rules_id = list(data.keys())
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
192
    assert len(rules_id) == 2
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
193
    referenc_result = tests.any_test_help.any_get_test_data_json(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
194
        'test_data/referenc_result_data_json.json')
195
    assert referenc_result[
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
196
        "xccdf_org.ssgproject.content_rule_package_abrt_removed"] == data[rules_id[0]]
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (86/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
197
    assert rule1 in rules_id[1]
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
198
199
200
def test_get_questions_not_selected(capsys):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
201
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
202
    regex = r'_package_\w+_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
203
    client = get_client_arf_to_json_with_option_show_not_selected_rules(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
204
        src, regex)
205
    tests.any_test_help.get_questions_not_selected(capsys, client)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
206
207
208
def test_get_questions_not_selected_and_show_failed_rules(capsys):
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_get_questions_not_selected_and_show_failed_rules" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
209
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
210
    regex = r'_package_\w+_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
211
    client = get_client_arf_to_json_with_option_show_not_selected_rules_and_show_failed_rules(
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (94/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
212
        src, regex)
213
    tests.any_test_help.get_questions_not_selected_and_show_failed_rules(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
214
        capsys, client)
215
216
217
def test_get_questions_with_option_show_failed_rules():
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_get_questions_with_option_show_failed_rules" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
218
    src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
219
    regex = r'_package_\w+_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
220
    client = get_client_arf_to_json_with_option_show_failed_rules(src, regex)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
221
    tests.any_test_help.get_questions_with_option_show_failed_rules(client)
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
222
223
224
def test_if_not_installed_inquirer_with_option_show_failed_rules(capsys):
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_if_not_installed_inquirer_with_option_show_failed_rules" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
225
    with mock.patch.dict(sys.modules, {'inquirer': None}):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
226
        src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
227
        regex = r'_package_\w+_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
228
        client = get_client_arf_to_json_with_option_show_failed_rules(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
229
            src, regex)
230
        client.isatty = True
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
231
        tests.any_test_help.if_not_installed_inquirer_with_option_show_failed_rules(
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (84/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
232
            capsys, client)
233
234
235
def test_if_not_installed_inquirer_with_option_show_not_selected_rules(
0 ignored issues
show
Coding Style Naming introduced by
Function name "test_if_not_installed_inquirer_with_option_show_not_selected_rules" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
236
        capsys):
237
    with mock.patch.dict(sys.modules, {'inquirer': None}):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
238
        src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
239
        regex = r'_package_\w+_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
240
        client = get_client_arf_to_json_with_option_show_not_selected_rules(
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
241
            src, regex)
242
        client.isatty = True
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
243
        tests.any_test_help.if_not_installed_inquirer_with_option_show_not_selected_rules(
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (90/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
244
            capsys, client)
245
246
247
def test_if_not_installed_inquirer_with_option_show_not_selected_rules_and_show_failed_rules(
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (93/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Coding Style Naming introduced by
Function name "test_if_not_installed_inquirer_with_option_show_not_selected_rules_and_show_failed_rules" doesn't conform to '[a-z_][a-z0-9_]2,30$' pattern ('[a-z_][a-z0-9_]2,30$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
introduced by
Missing function or method docstring
Loading history...
248
        capsys):
249
    with mock.patch.dict(sys.modules, {'inquirer': None}):
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 4 tabs, expected 1
Loading history...
250
        src = 'test_data/ssg-fedora-ds-arf.xml'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
251
        regex = r'_package_\w+_removed'
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
252
        client = get_client_arf_to_json_with_option_show_not_selected_rules_and_show_failed_rules(
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (98/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
253
            src, regex)
254
        client.isatty = True
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
255
        (tests.any_test_help.
0 ignored issues
show
Coding Style introduced by
Bad indentation. Found 8 tabs, expected 2
Loading history...
256
         if_not_installed_inquirer_with_option_show_not_selected_rules_and_show_failed_rules(
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (93/80).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
257
             capsys, client))
258