allow report to be sent when debugging (#3206)

This commit is contained in:
Cheick Keita 2023-06-21 09:42:45 -07:00 committed by GitHub
parent c752114643
commit a720dd1444
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -815,20 +815,34 @@ class DebugNotification(Command):
)
def test_template(
self, task_id: UUID_EXPANSION, notificationConfig: models.NotificationConfig
self,
notificationConfig: models.NotificationConfig,
task_id: Optional[UUID] = None,
report: Optional[Report] = None,
) -> responses.NotificationTestResponse:
"""Test a notification template"""
endpoint = Endpoint(self.onefuzz)
task = self.onefuzz.tasks.get(task_id)
input_blob_ref = BlobRef(
account="dummy-storage-account",
container="test-notification-crashes",
name="fake-crash-sample",
)
report = self._create_report(
task.job_id, task.task_id, "fake_target.exe", input_blob_ref
)
if task_id is None and report is None:
raise Exception("must specify either task_id or report")
endpoint = Endpoint(self.onefuzz)
if task_id is not None:
task = self.onefuzz.tasks.get(task_id)
input_blob_ref = BlobRef(
account="dummy-storage-account",
container="test-notification-crashes",
name="fake-crash-sample",
)
if report is None:
report = self._create_report(
task.job_id, task.task_id, "fake_target.exe", input_blob_ref
)
if task is not None:
report.task_id = task.task_id
report.job_id = task.job_id
report.report_url = "https://dummy-container.blob.core.windows.net/dummy-reports/dummy-report.json"
return endpoint._req_model(