In Field Service Lightning I have a Trigger on ServiceReport which sends an email with attachment coming from ContentVersion.
This is the Test class I have written.
@isTest
private class testCreateServiceReport{
static testMethod void validateWO() {
WorkOrder wo = new WorkOrder();
wo.subject = 'Testing';
insert wo;
ServiceAppointment sa = new ServiceAppointment();
sa.ParentRecordId = wo.Id;
sa.EarliestStartTime = DateTime.now();
sa.DueDate = DateTime.now();
insert sa;
List<ServiceReportLayout> srl = [Select Id FROM ServiceReportLayout];
ServiceReport sr = new ServiceReport();
sr.ParentId = sa.Id;
sr.Template = srl[0].Id; //Need to check if there is a way to avoid srl[0] notation
insert sr; //If I comment this the text result is pass. When I enable it I get too see the below mentioned error.
}
}
This is the error Methods defined as TestMethod do not support Web service callouts
I know that we need to write Test Classes for code that involves web service callouts using setMock() but I dont understand in what way inserting ServiceReport is related to making a callout.
Any help on this will be really helpful.