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

1.8.0 --> 1.9.3 requote_uri breaking mocks with encoded URLS #181

Open
shane-consensys opened this issue Jun 10, 2021 · 2 comments
Open

Comments

@shane-consensys
Copy link

shane-consensys commented Jun 10, 2021

Hey there,

I didn't have 1.8.0 pinned and noticed today that it was breaking previously working unit tests

    requests_mock.get(f'https://gitlab.com/api/v4/projects/{project_id}/repository/files/'
                      'project_configuration%2Fproject-configuration%2Ejson?ref=master',
                      headers={'Content-Type': 'application/json'},
                      text=('{"content": "ewoJInRlc3QiOiAidGVzdCIKfQ=="}'))

Using 1.9.3 this will fail with

No mock address: GET https://gitlab.com/api/v4/projects/1234567/repository/files/project_configuration%2Fproject-configuration%2Ejson?ref=master

For 1.8.0 it will work as expected.
Obviously the change was made for intended reasons
https://github.com/jamielennox/requests-mock/pull/169/files

but I'm just wondering since I couldn't see anything in the documentation about how to design the URLs in the mock to account for this

@jamielennox
Copy link
Owner

Sorry this has been so long - i really am stuck here on what the best implementation should be. In general i try and match requests as much as possible, but i don't see one option here being better than another.

You're right though, it was supposed to be a minimal bug fix and should be communicated better.

What do you suggest?

@shane-consensys
Copy link
Author

shane-consensys commented Apr 20, 2022

Hey sorry I'm no where near smart enough to suggest anything.

I just wonder for others though if there is a solution in how to format the url so it would work ? There will probably be a few developers hitting a similar issue with gitlab

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

No branches or pull requests

2 participants