Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix / cleanup paths in integration tests #11809

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docker/entrypoint-integration-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ else
else
fail "$test"
fi

test="False Positive History tests"
echo "Running: $test"
if python3 tests/false_positive_history_test.py ; then
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/open_source/upgrading/2.44.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ The Burp parser now has a custom deduplication configuration to make deduplicati
This command has various command line arguments to tweak its behavior, for example to trigger a run of the deduplication process.
See [dedupe.py](https://github.com/DefectDojo/django-DefectDojo/blob/master/dojo/management/commands/dedupe.py) for more information.

---
---

Check the [Release Notes](https://github.com/DefectDojo/django-DefectDojo/releases/tag/2.44.0) for the contents of the release.
5 changes: 4 additions & 1 deletion dojo/engagement/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1585,6 +1585,7 @@ def get_foreign_keys():


def csv_export(request):
logger.debug("starting csv export")
engagements, test_counts = get_engagements(request)

response = HttpResponse(content_type="text/csv")
Expand Down Expand Up @@ -1617,11 +1618,12 @@ def csv_export(request):
fields.append(test_counts.get(engagement.id, 0))

writer.writerow(fields)

logger.debug("done with csv export")
return response


def excel_export(request):
logger.debug("starting excel export")
engagements, test_counts = get_engagements(request)

workbook = Workbook()
Expand Down Expand Up @@ -1667,4 +1669,5 @@ def excel_export(request):
content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
)
response["Content-Disposition"] = "attachment; filename=engagements.xlsx"
logger.debug("done with excel export")
return response
2 changes: 1 addition & 1 deletion tests/Import_scanner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select

dir_path = Path(os.path.realpath(__file__)).parent
dir_path = str(Path(os.path.realpath(__file__)).parent)

logger = logging.getLogger(__name__)

Expand Down
14 changes: 6 additions & 8 deletions tests/close_old_findings_dedupe_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

logger = logging.getLogger(__name__)

dir_path = Path(os.path.realpath(__file__)).parent


class CloseOldDedupeTest(BaseTestCase):
# --------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -137,7 +135,7 @@ def test_import_same_engagement_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/dedupe_scans/dedupe_endpoint_1.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "dedupe_scans/dedupe_endpoint_1.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="3 findings and closed 0 findings"))
Expand All @@ -154,7 +152,7 @@ def test_import_same_engagement_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/dedupe_scans/dedupe_endpoint_1.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "dedupe_scans/dedupe_endpoint_1.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="3 findings and closed 0 findings"))
Expand All @@ -176,7 +174,7 @@ def test_close_same_engagement_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/dedupe_scans/dedupe_and_close_1.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "dedupe_scans/dedupe_and_close_1.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="1 findings and closed 2 findings"))
Expand Down Expand Up @@ -244,7 +242,7 @@ def test_import_same_product_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings_product_scope").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/dedupe_scans/dedupe_endpoint_1.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "dedupe_scans/dedupe_endpoint_1.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="3 findings and closed 0 findings"))
Expand All @@ -261,7 +259,7 @@ def test_import_same_product_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings_product_scope").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/dedupe_scans/dedupe_endpoint_1.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "dedupe_scans/dedupe_endpoint_1.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="3 findings and closed 0 findings"))
Expand All @@ -283,7 +281,7 @@ def test_close_same_product_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings_product_scope").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/dedupe_scans/dedupe_and_close_1.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "dedupe_scans/dedupe_and_close_1.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="1 findings and closed 2 findings"))
Expand Down
14 changes: 6 additions & 8 deletions tests/close_old_findings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@

logger = logging.getLogger(__name__)

dir_path = Path(os.path.realpath(__file__)).parent


class CloseOldTest(BaseTestCase):
# --------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -95,7 +93,7 @@ def test_import_same_engagement_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/close_old_scans/closeold_nodedupe_1.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "close_old_scans/closeold_nodedupe_1.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="3 findings and closed 0 findings"))
Expand All @@ -112,7 +110,7 @@ def test_import_same_engagement_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/close_old_scans/closeold_nodedupe_2.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "close_old_scans/closeold_nodedupe_2.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="3 findings and closed 3 findings"))
Expand All @@ -134,7 +132,7 @@ def test_close_same_engagement_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/dedupe_scans/dedupe_and_close_1.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "dedupe_scans/dedupe_and_close_1.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="1 findings and closed 3 findings"))
Expand Down Expand Up @@ -198,7 +196,7 @@ def test_import_same_product_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings_product_scope").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/close_old_scans/closeold_nodedupe_1.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "close_old_scans/closeold_nodedupe_1.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="3 findings and closed 0 findings"))
Expand All @@ -215,7 +213,7 @@ def test_import_same_product_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings_product_scope").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/close_old_scans/closeold_nodedupe_2.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "close_old_scans/closeold_nodedupe_2.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="3 findings and closed 3 findings"))
Expand All @@ -237,7 +235,7 @@ def test_close_same_product_tests(self):
scan_environment = Select(driver.find_element(By.ID, "id_environment"))
scan_environment.select_by_visible_text("Development")
driver.find_element(By.ID, "id_close_old_findings_product_scope").click()
driver.find_element(By.ID, "id_file").send_keys(self.relative_path + "/dedupe_scans/dedupe_and_close_1.xml")
driver.find_element(By.ID, "id_file").send_keys(self.relative_path / "dedupe_scans/dedupe_and_close_1.xml")
driver.find_elements(By.CLASS_NAME, "btn-primary")[1].click()

self.assertTrue(self.is_success_message_present(text="1 findings and closed 3 findings"))
Expand Down
Loading