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

adding status message for bad request + tests #1022

Merged
merged 6 commits into from
Feb 23, 2016

Conversation

codiebeulaine
Copy link
Contributor

No description provided.

@codiebeulaine
Copy link
Contributor Author

@justinvdm not quite sure why the test is failing?

@hodgestar
Copy link
Contributor

The failures might be related to treq no longer supporting Python 2.6. I
have a PR open for officially removing Python 2.6 support.
On 22 Feb 2016 17:42, "codie" notifications@github.com wrote:

@justinvdm https://github.com/justinvdm not quite sure why the test is
failing?


Reply to this email directly or view it on GitHub
#1022 (comment).

@codiebeulaine
Copy link
Contributor Author

@hodgestar @justinvdm ready for review :)

message['message_id'],
reason='Received status code: %s' % (response.code,))
returnValue(nack)
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason this method was converted to inlineCallbacks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@justinvdm knows more about the reasoning I think

Copy link
Contributor

Choose a reason for hiding this comment

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

Can't remember tbh, maybe because we were doing other things in this method at some stage (like publishing statuses). I think we can put it back to how it was.

Copy link
Contributor

Choose a reason for hiding this comment

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

@codiebeulaine
Copy link
Contributor Author

@hodgestar @justinvdm added the good request stuff

request.setResponseCode(http.BAD_REQUEST)
return ''
raise WeChatException('Bad request for incoming message')
elif is_verifiable(request):
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to check is_verifiable again here. If we don't raise the exception, we should always call add_status_good_req?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed :)

'signature': good_signature,
'timestamp': timestamp,
'nonce': nonce,
}

default_params.update(params)
path += '?%s' % (urlencode(default_params),)
params.update(underrides)
Copy link
Contributor

Choose a reason for hiding this comment

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

The params handling is a bit odd. The underrides are possibly what is passed in by the user (i.e. underrides = kw.setdefault('params', {})) and they override the default params (i.e. params.update(underrides)). Maybe it would be clearer to do:

params = {
    'signature': good_signature,
    ...
}
params.update(kw.get('params', {}))
kw['params'] = params

?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

changed 👍

@hodgestar
Copy link
Contributor

@codiebeulaine Please no commit messages like cleaning up. ;)

@hodgestar
Copy link
Contributor

Left a couple of comments and questions, but otherwise looks good. :)

@codiebeulaine
Copy link
Contributor Author

@hodgestar changed some things above, Do I need to change the method above back or can I get a +1 ?

@hodgestar
Copy link
Contributor

👍

codiebeulaine added a commit that referenced this pull request Feb 23, 2016
…gration

adding status message for bad request + tests
@codiebeulaine codiebeulaine merged commit 229a7f4 into develop Feb 23, 2016
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

3 participants