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

Commit a720dd1

Browse files
authored
allow report to be sent when debugging (#3206)
1 parent c752114 commit a720dd1

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

src/cli/onefuzz/debug.py

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -815,20 +815,34 @@ def task(
815815
)
816816

817817
def test_template(
818-
self, task_id: UUID_EXPANSION, notificationConfig: models.NotificationConfig
818+
self,
819+
notificationConfig: models.NotificationConfig,
820+
task_id: Optional[UUID] = None,
821+
report: Optional[Report] = None,
819822
) -> responses.NotificationTestResponse:
820823
"""Test a notification template"""
824+
825+
if task_id is None and report is None:
826+
raise Exception("must specify either task_id or report")
827+
821828
endpoint = Endpoint(self.onefuzz)
822-
task = self.onefuzz.tasks.get(task_id)
823-
input_blob_ref = BlobRef(
824-
account="dummy-storage-account",
825-
container="test-notification-crashes",
826-
name="fake-crash-sample",
827-
)
829+
if task_id is not None:
830+
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
828845

829-
report = self._create_report(
830-
task.job_id, task.task_id, "fake_target.exe", input_blob_ref
831-
)
832846
report.report_url = "https://dummy-container.blob.core.windows.net/dummy-reports/dummy-report.json"
833847

834848
return endpoint._req_model(

0 commit comments

Comments
 (0)