| Total Complexity | 4 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 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 |