Passed
Push — master ( 9a0bfb...c81a77 )
by Matěj
02:50 queued 11s
created

test_json_to_html.test_prepare_tree()   A

Complexity

Conditions 1

Size

Total Lines 6
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 6
nop 0
dl 0
loc 6
rs 10
c 0
b 0
f 0
1
import pytest
2
import tempfile
3
import os
4
import uuid
5
6
from oval_graph.json_to_html import JsonToHtml
7
import tests.any_test_help
8
9
10
def get_client_json_to_html(src):
11
    return JsonToHtml(
12
        ["--off-web-browser", tests.any_test_help.get_src(src)])
13
14
15
def get_client_json_to_html_with_define_dest(src):
16
    return JsonToHtml(
17
        ["--output", tests.any_test_help.get_src(
18
            os.path.join(tempfile.gettempdir(), str(uuid.uuid4()))),
19
         "--off-web-browser",
20
         tests.any_test_help.get_src(src)])
21
22
23
@pytest.mark.usefixtures("remove_generated_reports_in_root")
24
def test_prepare_tree():
25
    src = 'test_data/referenc_result_data_json.json'
26
    client = get_client_json_to_html(src)
27
    results_src = client.prepare_data()
28
    tests.any_test_help.compare_results_js(results_src[0])
29
30
31
def test_prepare_tree_and_save_in_defined_destination():
32
    src = 'test_data/referenc_result_data_json.json'
33
    client = get_client_json_to_html_with_define_dest(src)
34
    results_src = client.prepare_data()
35
    tests.any_test_help.compare_results_js(results_src[0])
36