Skip to content
This repository was archived by the owner on Nov 1, 2023. It is now read-only.

Commit 06fb0d3

Browse files
authored
Kanan/test template fix (#3308)
* Fix test_template logic * Rewrite test_template logic to make it's intention more clear
1 parent 9bc1ab3 commit 06fb0d3

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

src/cli/onefuzz/debug.py

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -822,29 +822,26 @@ def test_template(
822822
) -> responses.NotificationTestResponse:
823823
"""Test a notification template"""
824824

825-
if task_id is None and report is None:
826-
raise Exception("must specify either task_id or report")
827-
828-
endpoint = Endpoint(self.onefuzz)
829825
if task_id is not None:
830826
task = self.onefuzz.tasks.get(task_id)
831-
input_blob_ref = BlobRef(
832-
account="dummy-storage-account",
833-
container="test-notification-crashes",
834-
name="fake-crash-sample",
835-
)
836-
837-
if report is None:
838-
report = self._create_report(
839-
task.job_id, task.task_id, "fake_target.exe", input_blob_ref
840-
)
841-
842-
if task is not None:
843-
report.task_id = task.task_id
844-
report.job_id = task.job_id
827+
if report is None:
828+
input_blob_ref = BlobRef(
829+
account="dummy-storage-account",
830+
container="test-notification-crashes",
831+
name="fake-crash-sample",
832+
)
833+
report = self._create_report(
834+
task.job_id, task.task_id, "fake_target.exe", input_blob_ref
835+
)
836+
else:
837+
report.task_id = task.task_id
838+
report.job_id = task.job_id
839+
elif report is None:
840+
raise Exception("must specify either task_id or report")
845841

846842
report.report_url = "https://dummy-container.blob.core.windows.net/dummy-reports/dummy-report.json"
847843

844+
endpoint = Endpoint(self.onefuzz)
848845
return endpoint._req_model(
849846
"POST",
850847
responses.NotificationTestResponse,

0 commit comments

Comments
 (0)