- You can now match on the empty query string value like /path?a.
- Pins version of requests to <3 to prepare for new release of requests in future.
Increase the minimum required requests version to 2.3
- The minimum version of requests has been increase to 2.3. This simply ensures that all documented features of requests-mock are actually available. This version of requests is still quite old and if this is an issue you should either pin requests-mock to <1.6 or preferably update requests.
- Remove weakref objects from the request/response that will allow the objects to be pickled with the regular python mechanisms.
- If you specified a charset in the Content-Type of a response it would be ignored and overriden with either ‘utf-8’ or None depending on the type of response content passed in. If you pass this value we should honour it and perform the encoding correctly.
Fix py.test plugin with py.test < 3.0
- Fixed a bug relating to how the pytest version was being discovered that meant new versions of pytest were being treated as old versions and would receive bad configuration.
- The py.test plugin was broken when using py.test < 3.0. The version of py.test that ships in EPEL is only 2.7 so we need to make sure we support at least that version.
- The stream parameter is recorded when the request is sent and available in request history in the same was as parameters like verify or timeout.
- Added pytest fixture for native integration into pytest projects.
- In this release the main repository was moved off of OpenStack provided infrastructure and onto github at https://github.com/jamielennox/requests-mock. OpenStack has been a great home for the project however requests-mock is a general python project with no specific relationship to OpenStack and the unfamiliar infrastructure was limiting contributes from the wider community.
- Allow specifying an additional_matcher to the mocker that will call a function to allow a user to add their own custom request matching logic.
Add a called_once property to the mockers.
It is now possible to make URL matching and request history not lowercase the provided URLs.
Installing the requirements for the ‘fixture’ contrib package can now be done via pip with pip install requests-mock[fixture]
- A called_once property was added to the adapter and the mocker. This gives us an easy way to emulate mock’s assert_called_once.
- You can pass case_sensitive=True to an adapter or set requests_mock.mock.case_sensitive = True globally to enable case sensitive matching.
- Added ‘fixture’ to pip extras so you can install the fixture requirements with pip install requests-mock[fixture]
- It is recommended you add requests_mock.mock.case_sensitive = True to your base test file to globally turn on case sensitive matching as this will become the default in a 2.X release.
- Reported in bug #1584008 all request matching is done in a case insensitive way, as a byproduct of this request history is handled in a case insensitive way. This can now be controlled by setting case_sensitive to True when creating an adapter or globally.