-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Assert expected_params
stubber
#784
Conversation
Allows you to specify what parameters that you are to expect for a response and if they do not match, throw an error.
Nice! 🚢
Seems reasonable. It probably won't matter much in practice -- once a mismatch occurs, an exception is thrown and the test will likely halt at that point. |
@@ -154,7 +176,13 @@ def add_client_error(self, method, service_error_code='', | |||
} | |||
|
|||
operation_name = self.client.meta.method_to_api_mapping.get(method) | |||
response = (operation_name, (http_response, parsed_response)) | |||
# Note that we do not allow for expected_params in the | |||
# adding errors into the queue yet. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would replace 'in the' with 'while'.
⛵ Nice! |
|
Assert ``expected_params`` stubber
Allows you to specify what parameters that you are to expect for a response and if they do not match, throw an error.
I have been writing a fair amount of tests using this stubber. I have found this sort of response/expected_params matching as being pretty useful and was using it an awful lot.
The only behavior I am not sure about and would be up for opinions is what happens to the stubber's corresponding response when an
expected_params
does not match. Should it use up the response in the queue? Or should it keep the original response in the queue so that it can be called later? I decided to go with the later because in the current stubber logic if there is a parameter validation error with the client, we will not pop the response off of the queue. So I thoughtexpected_params
would have a similar expectation.cc @jamesls @mtdowling @rayluo @JordonPhillips