we have a managed package and the function call_out is making a http request. In the package we can use this code to create a test for it:
Test.startTest(); Test.setMock(HttpCalloutMock.class, new Mock()); call_out(curid); Test.stopTest();
however when we installed this package in another org, we want to use this function again, however in test, it fails.
Test.startTest(); Test.setMock(HttpCalloutMock.class, new package.Mock()); package.call_out(curid); Test.stopTest();
it gives us this error:
Methods defined as TestMethod do not support Web service callouts
what is wrong? and whether it is possible to test it in target org? is going around it using Test.isRunningTest() the only possible way?