Skip to content

Commit 39b6c04

Browse files
sofyakurilovahitnik
authored andcommitted
Adds html report
1 parent 4b543ad commit 39b6c04

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

modules/test/dns/python/src/dns_module.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
LOG_NAME = 'test_dns'
2424
MODULE_REPORT_FILE_NAME = 'dns_report.j2.html'
25+
MODULE_REPORT_STYLED_FILE_NAME = 'dns_report.jinja2'
2526
DNS_SERVER_CAPTURE_FILE = '/runtime/network/dns.pcap'
2627
STARTUP_CAPTURE_FILE = '/runtime/device/startup.pcap'
2728
MONITOR_CAPTURE_FILE = '/runtime/device/monitor.pcap'
@@ -161,6 +162,7 @@ def generate_module_report(self):
161162
pages_content.append(current_page_rows)
162163

163164
report_html = ''
165+
report_jinja_preview = ''
164166
if not pages_content:
165167
pages_content = [[]]
166168

@@ -175,9 +177,23 @@ def generate_module_report(self):
175177
module_data=page_rows
176178
)
177179
report_html += page_html
180+
page_html = template.render(
181+
base_template=self._base_template_file_preview,
182+
module_header=module_header_repr,
183+
summary_headers=summary_headers,
184+
summary_data=summary_data,
185+
module_data_headers=module_data_headers,
186+
module_data=page_rows
187+
)
188+
report_jinja_preview += page_html
178189

179190
LOGGER.debug('Module report:\n' + report_html)
180191

192+
# Generate styled report for a preview
193+
jinja_path_styled = os.path.join(
194+
self._results_dir, MODULE_REPORT_STYLED_FILE_NAME)
195+
self._render_styled_report(report_jinja_preview, jinja_path_styled)
196+
181197
# Use os.path.join to create the complete file path
182198
report_path = os.path.join(self._results_dir, MODULE_REPORT_FILE_NAME)
183199

0 commit comments

Comments
 (0)