Getting “TestMethod does not support Web service callouts”, callout is in managed trigger

I’m getting an error when trying to test a Lead conversion trigger that the TestMethod doesn’t support Web service callouts. (As an aside: it’s Scott Hemeter’s code for setting Primary and a Role on the OCR when converting a Lead: )

But there are no callouts in my trigger or any other editable code. It seems very likely that the issue is with an installed Pardot app. The other managed app with a trigger on Lead (or Contact/Acct/Opp) is, which I suppose could also be the culprit. Is there anyway to bypass these managed triggers when my own test is executing?


Sadly not, i’ve encountered this before and tried using the HTTP Mocking features in Apex to mock the callout in the managed package code, without success. I now see this has been confirmed in the documentation as not being possible.

If the code that performs the callout is in a managed package, you must call Test.setMock from a test method in the same package with the same namespace to mock the callout.

So unfortunately you will have to contact the package author to see if they have a means, perhaps via Custom Setting or other config to disable their trigger logic, which you could effect in your test code before their trigger gets invoked.

Source : Link , Question Author : Thomas Taylor , Answer Author : Andrew Fawcett

Leave a Comment