twilio / twilio-salesforce

A Salesforce/Force.com library for communicating with the Twilio REST API and generating TwiML. Need help? Post your questions to http://getsatisfaction.com/twilio or email us at help@twilio.com
http://www.twilio.com/salesforce
MIT License
189 stars 136 forks source link

Resolving test problems on query params order generation by using cor… #64

Open edmondop opened 6 years ago

edmondop commented 6 years ago

This resolves the problem that test would fail in some organization due to order of generation of query parameters.

If one runs for example Twilio_TestPhoneNumbers.testTwilioAvailablePhoneNumbers_AreaCodeFilter

on an organization where tests fail, one can read on the log

15:25:48:017 USER_DEBUG [98]|DEBUG|Twilio_TestHTTPMock::putResponse() Added resource GET HTTPS://API.TWILIO.COM/2010-04-01/ACCOUNTS/ACBA8BC05EACF94AFDAE398E642C9CC32D/AVAILABLEPHONENUMBERS/US/LOCAL.JSON?AREACODE=510&CONTAINS=51034*****

.... 15:25:48:264 USER_DEBUG [77]|DEBUG|Twilio_TestHTTPMock::getResponse() Did not find Resource for GET https://api.twilio.com/2010-04-01/Accounts/ACba8bc05eacf94afdae398e642c9cc32d/AvailablePhoneNumbers/US/Local.json?Contains=51034*****&AreaCode=510

As you can see the order of the query parameters AreaCode/Contains is inverted and therefore it fails to find the resource and answer with a 404

screen shot 2017-10-10 at 16 05 59