[SalesForce] Change password – how to test this

I have generated a VF page for end users to change their password. Within the method, I used the outbound web service call to verify whether their old password entered are correct. The code is copied from this page: http://developer.force.com/cookbook/recipe/verifying-password.

But I just can't think of a way to test this… If I create a new user and runas that user, it will pop up all the user info into UserInfo class, but I don't think outbound webservice call to test.salesforce.com will have that user info. Any suggestions?

Best Answer

You will need to create a HttpCalloutMock that mocks the response from Salesforce Partner API.

See Testing HTTP Callouts by Implementing the HttpCalloutMock Interface

Related Topic