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

Allow mocking preferences #217

Open ianhoffman opened 3 years ago

ianhoffman commented 3 years ago

This PR allows us to override preferences when testing with the GET test/<locale>?command=<foo> endpoint. Specifically, it allows the following syntax:

GET test/locale?command=<foo>&<pref_name_1>=<pref_value_1>&<pref_name_2>=<pref_value_2>.... For example:

GET http://localhost/test/en?command=2&conversion_strategy=US+EPA will use the US EPA conversion strategy, whereas GET http://localhost/test/en?command=2&conversion_strategy=NONEwill use the default conversion strategy — regardless of what the client has selected. You can override any preference, soalert_frequencyandalert_threshold` are fair game too. This should ease QA a bit during testing since we don't need to go through the whole menu to set a pref.