Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pwndocImportAutomator
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBERSEC
TNS
pwndocImportAutomator
Commits
776ae735
There was an error fetching the commit references. Please try again later.
Commit
776ae735
authored
2 years ago
by
Ondřej Borýsek
Browse files
Options
Downloads
Patches
Plain Diff
Test report generation inside PwnDoc
parent
34286191
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_findings_parsing.py
+13
-3
13 additions, 3 deletions
tests/test_findings_parsing.py
with
13 additions
and
3 deletions
tests/test_findings_parsing.py
+
13
−
3
View file @
776ae735
...
...
@@ -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
()
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment