airq-dev / hazebot

Building the 411 for air quality in the United States: a texting platform accessible to all, that provides actionable local information to protect your and your community.
https://www.hazebot.org/
MIT License
9 stars 1 forks source link

Support multiple from numbers #181

Closed ianhoffman closed 3 years ago

ianhoffman commented 3 years ago

LGTM assuming tests pass. Just want a little more explanation on the changes you did for tests

yah for sure. I made it so that we actually call the twilio client in testing, bc i want to assert that we're calling it with the spanish or english phone numbers as determined by the client's locale setting. To do this, I thought it would be safest if we always mock out the call, so that we don't have to remember to do it in every test (since we never want to really call the client in testing). So I created a generic way to declare patchings which will be applied before each test runs and reset after each test. The first two patching are for time, which uses our existing MockDateTime impl, and a mocked version of the Twilio client's create method. These two mocks both implement a start() and stop() interface so that we can start them before tests and reset them between tests.