@@ -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