Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mocking preferences #217

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Allow mocking preferences #217

wants to merge 6 commits into from

Conversation

ianhoffman
Copy link
Collaborator

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=NONE` will use the default conversion strategy — regardless of what the client has selected. You can override any preference, so alert_frequency and alert_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.

return cls._prefs[name]

@classmethod
def get_default(cls, name: str) -> typing.Union[str, int]:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused 💀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant