function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Steve MunLeeuw 15Steve MunLeeuw 15 

Undelete unit test on contact with Cloudingo installed fails with 'Methods defined as TestMethod do not support Web service callouts'

I have a unit test that covers the undelete of contacts, but it is failing with the message: 'Methods defined as TestMethod do not support Web service callouts'
I believe this is because the installed Cloudingo package also has a trigger on the contact object named ContactUpdatePOSyncTrigger.  There is also a connected app for this package.  The failure doesn't occur until Test.stopTest() is called so it's difficult to narrow it down further.  Is there a way to disable a managed package while running unit tests?  I don't believe I can mock this service callout since it's in a mananged package, and really I have no insight into what the method signature is.

Thanks,
Steve MunLeeuw
Best Answer chosen by Steve MunLeeuw 15
Ginny MahantGinny Mahant
The failure occurs after stopTest because all asynchronous calls made after the startTest method are collected by the system. When stopTest is executed, all asynchronous processes are run synchronously. Check with Cloudingo  if they allow you to disable their triggers through a custom setting or some other mean. Or speak to Cloudingo and see if they have any advice for how to work with their triggers.  
Please tag as best answer if it helps resolve the issue.
Regards,

All Answers

Ginny MahantGinny Mahant
The failure occurs after stopTest because all asynchronous calls made after the startTest method are collected by the system. When stopTest is executed, all asynchronous processes are run synchronously. Check with Cloudingo  if they allow you to disable their triggers through a custom setting or some other mean. Or speak to Cloudingo and see if they have any advice for how to work with their triggers.  
Please tag as best answer if it helps resolve the issue.
Regards,
This was selected as the best answer
v varaprasadv varaprasad
Hi Steve,

I think in your class you are using Http classes .To cover Http classes you need to implement HttpCalloutMock Interface.

Please check once below link for more info : 

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_restful_http_testing_httpcalloutmock.htm

https://developer.salesforce.com/blogs/developer-relations/2013/03/testing-apex-callouts-using-httpcalloutmock.html

https://developer.salesforce.com/forums/ForumsMain?id=9060G000000UWOQQA4




 Otherwise please share your code.
 Let us know it helps you, and kindly close your query by choosing best answer if you got your answer.

Thanks
Varaprasad