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

Improve aiohttp JSONMatcher support #139

Merged

Conversation

KyleJamesWalker
Copy link
Contributor

@KyleJamesWalker KyleJamesWalker commented Oct 2, 2024

The current implementation of the aiohttp interceptor does not account for using the json argument.

Before this PR you would get the following error when using the json param from aiohttp
with the JSONMatcher:

    def no_matches(self, msg):
        """Raise `PookNoMatches` and reduce pytest printed stacktrace noise"""
>       raise PookNoMatches(msg)
E       pook.exceptions.PookNoMatches: pook error!
E       
E       => Cannot match any mock for the following request:
E       ==================================================
E       Method: POST
E       URL: http://example.com
E       ==================================================
E       
E       => Detailed matching errors:
E       JSONMatcher: 'NoneType' object has no attribute 'decode'

Copy link
Collaborator

@sarayourfriend sarayourfriend left a comment

Choose a reason for hiding this comment

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

Thanks very much for the contribution @KyleJamesWalker. I'm travelling and short on time at the moment, so am able to cut a release right now, but will look to do so sometime in the middle of next week.

src/pook/interceptors/aiohttp.py Outdated Show resolved Hide resolved
@sarayourfriend sarayourfriend merged commit 2683231 into h2non:master Oct 5, 2024
8 checks passed
@sarayourfriend
Copy link
Collaborator

sarayourfriend commented Oct 8, 2024

@KyleJamesWalker published as 2.0.1 on PyPI and GitHub: https://github.com/h2non/pook/releases/tag/v2.0.1

Thanks again for the contribution.

@KyleJamesWalker KyleJamesWalker deleted the fix-jsonmatcher-aiohttp branch October 14, 2024 19:37
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.

2 participants