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

test_json_to_html   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 27
dl 0
loc 36
rs 10
c 0
b 0
f 0
wmc 4

4 Functions

Rating   Name   Duplication   Size   Complexity  
A get_client_json_to_html_with_define_dest() 0 6 1
A get_client_json_to_html() 0 3 1
A test_prepare_tree() 0 6 1
A test_prepare_tree_and_save_in_defined_destination() 0 5 1
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