|
1 | 1 | import copy
|
2 | 2 | import json
|
3 | 3 | import logging
|
4 |
| -import os |
5 | 4 | from functools import wraps
|
6 | 5 | from itertools import chain
|
7 | 6 | from pathlib import Path
|
|
40 | 39 |
|
41 | 40 |
|
42 | 41 | def get_unit_tests_path():
|
43 |
| - return str(Path(os.path.realpath(__file__)).parent) |
| 42 | + return Path(__file__).parent |
| 43 | + |
| 44 | + |
| 45 | +def get_unit_tests_scans_path(parser): |
| 46 | + return Path(__file__).parent / "scans" / parser |
44 | 47 |
|
45 | 48 |
|
46 | 49 | def toggle_system_setting_boolean(flag_name, value):
|
@@ -504,7 +507,7 @@ def import_scan_with_params(self, filename, scan_type="ZAP Scan", engagement=1,
|
504 | 507 | product_name=None, product_type_name=None, auto_create_context=None, expected_http_status_code=201, test_title=None,
|
505 | 508 | scan_date=None, service=None, forceActive=True, forceVerified=True):
|
506 | 509 |
|
507 |
| - with open(get_unit_tests_path() + "/" + filename, encoding="utf-8") as testfile: |
| 510 | + with open(get_unit_tests_path() / filename, encoding="utf-8") as testfile: |
508 | 511 | payload = {
|
509 | 512 | "minimum_severity": minimum_severity,
|
510 | 513 | "active": active,
|
@@ -556,7 +559,7 @@ def import_scan_with_params(self, filename, scan_type="ZAP Scan", engagement=1,
|
556 | 559 | def reimport_scan_with_params(self, test_id, filename, scan_type="ZAP Scan", engagement=1, minimum_severity="Low", active=True, verified=False, push_to_jira=None,
|
557 | 560 | tags=None, close_old_findings=True, group_by=None, engagement_name=None, scan_date=None,
|
558 | 561 | product_name=None, product_type_name=None, auto_create_context=None, expected_http_status_code=201, test_title=None):
|
559 |
| - with open(get_unit_tests_path() + "/" + filename, encoding="utf-8") as testfile: |
| 562 | + with open(get_unit_tests_path() / filename, encoding="utf-8") as testfile: |
560 | 563 | payload = {
|
561 | 564 | "minimum_severity": minimum_severity,
|
562 | 565 | "active": active,
|
@@ -605,7 +608,7 @@ def reimport_scan_with_params(self, test_id, filename, scan_type="ZAP Scan", eng
|
605 | 608 | def endpoint_meta_import_scan_with_params(self, filename, product=1, product_name=None,
|
606 | 609 | create_endpoints=True, create_tags=True, create_dojo_meta=True,
|
607 | 610 | expected_http_status_code=201):
|
608 |
| - with open(get_unit_tests_path() + "/" + filename, encoding="utf-8") as testfile: |
| 611 | + with open(get_unit_tests_path() / filename, encoding="utf-8") as testfile: |
609 | 612 | payload = {
|
610 | 613 | "create_endpoints": create_endpoints,
|
611 | 614 | "create_tags": create_tags,
|
|
0 commit comments