Skip to content
Snippets Groups Projects
Commit 776ae735 authored by Ondřej Borýsek's avatar Ondřej Borýsek
Browse files

Test report generation inside PwnDoc

parent 34286191
No related branches found
No related tags found
No related merge requests found
......@@ -37,14 +37,18 @@ def skip_if_no_pwndoc():
class TestFindingParsing:
@test_steps('PwnDoc Templates, Scan2Report, JSON', 'Upload to PwnDoc Audit')
@test_steps('PwnDoc Templates, Scan2Report, JSON', 'Upload to PwnDoc Audit', 'Download PwnDoc audit report')
@pytest.mark.parametrize("filepath", find_all_test_files())
def test_full(self, client, filepath):
folder_name = self.to_json(client, filepath)
yield
self.upload_to_pwndoc(folder_name)
yield
# todo: check audit is downloadable
test_filename = os.path.basename(filepath)
self.download_report(folder_name, test_filename)
yield
def to_json(self, client, filepath: str) -> str:
response = client.post(
......@@ -80,7 +84,7 @@ class TestFindingParsing:
return folder_name
def upload_to_pwndoc(self, folder_name):
def upload_to_pwndoc(self, folder_name: str):
audit_id = pwndoc_api.create_audit()
ps = ProcessingSettings.load_from_folder_name(folder_name)
assert ps is not None
......@@ -90,3 +94,9 @@ class TestFindingParsing:
ps.save()
assert upload_scan_findings_to_pwndoc(folder_name)
def download_report(self, folder_name: str, test_filename: str):
ps = ProcessingSettings.load_from_folder_name(folder_name)
report_filepath = os.path.abspath(os.path.join(TMP_PATH, f'{test_filename}.docx'))
pwndoc_api.download_report(ps.audit_id, report_filepath)
assert Path(report_filepath).is_file()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment