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

FIX a typo causing an ERROR log #523

Merged
merged 4 commits into from
Nov 16, 2017
Merged

FIX a typo causing an ERROR log #523

merged 4 commits into from
Nov 16, 2017

Conversation

mvalkon
Copy link
Collaborator

@mvalkon mvalkon commented Oct 5, 2017

A small bug was introduced in #500 when sanitizing the request query
parameters. Instead of fetching the arguments from request.query,
the parameters were sanitized from the request.form. This causes an
error log to be printed, as the parameters are not expected for the
query (for example in the case of a POST request).

Fixes #522

@coveralls
Copy link

coveralls commented Oct 5, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling a220460 on mvalkon:fix/522 into 94f64b8 on zalando:master.

@hjacobs
Copy link
Contributor

hjacobs commented Oct 5, 2017

@mvalkon can you please add a test for this? Thanks!

@mvalkon
Copy link
Collaborator Author

mvalkon commented Oct 5, 2017

@hjacobs yup, I was working on that already but then realised this one is hard to test with the current test functions. I might have to add a test for the parameter.wrapper-function which is a bit more low level than what the tests currently have.

@mvalkon
Copy link
Collaborator Author

mvalkon commented Nov 14, 2017

@hjacobs @flyte finally had a chance to look at the test, sorry for taking such a long time with this simple fix.

The problem I have is that the only way I could think of to actually test this is to assert that certain logging messages are either present, or not. For example, in the case of #522, we could:

  1. Assert that the correct messages get logged for formData-parameters
  2. Assert that the messages for query parameters in case of formData are not logged

I can do this, but this means I'll have to introduce a backwards compatible library for testing logging messages (testfixtures for example). Do we think it's worth it for just this one test?

@mvalkon
Copy link
Collaborator Author

mvalkon commented Nov 14, 2017

@hjacobs I've added the test described. Let me know if you think this should be added.

setup.py Outdated
@@ -30,6 +30,7 @@ def read_version(package):
'inflection>=0.3.1',
'pathlib>=1.0.1; python_version < "3.4"',
'typing>=3.6.1; python_version < "3.6"',
'testfixtures>=5.3.0'
Copy link
Contributor

Choose a reason for hiding this comment

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

this will pull in testfixtures everywhere, but we only need it for tests

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yup, sorry about that. Added it in the requirements-devel.txt

@coveralls
Copy link

coveralls commented Nov 14, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 44140de on mvalkon:fix/522 into f846126 on zalando:master.

@mvalkon mvalkon force-pushed the fix/522 branch 3 times, most recently from 9595cb6 to c1def85 Compare November 14, 2017 11:54
@coveralls
Copy link

coveralls commented Nov 14, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 9595cb6 on mvalkon:fix/522 into f846126 on zalando:master.

@coveralls
Copy link

coveralls commented Nov 14, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling c1def85 on mvalkon:fix/522 into f846126 on zalando:master.

A small bug was introduced in spec-first#500 when sanitizing the request query
parameters. Instead of fetching the arguments from `request.query`,
the parameters were sanitized from the `request.form`. This causes an
error log to be printed, as the parameters are not expected for the
query (for example in the case of a POST request).

Fixes spec-first#504
Adds a simple fixture to test form and query parameter sanitazion. This
is mostly related to spec-first#522, in which the `formData` parameters were
treated as query parameters.
@coveralls
Copy link

coveralls commented Nov 15, 2017

Coverage Status

Coverage remained the same at 100.0% when pulling 4b00ede on mvalkon:fix/522 into 0918a9e on zalando:master.

@mvalkon mvalkon added ready and removed in progress labels Nov 15, 2017
@mvalkon
Copy link
Collaborator Author

mvalkon commented Nov 16, 2017

@hjacobs ping

@hjacobs
Copy link
Contributor

hjacobs commented Nov 16, 2017

👍

@hjacobs hjacobs merged commit f4bc6dc into spec-first:master Nov 16, 2017
@mvalkon mvalkon deleted the fix/522 branch November 16, 2017 12:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants