Bases: requests.adapters.BaseAdapter, requests_mock.adapter._RequestHistoryTracker
A fake adapter than can return predefined responses.
Register a custom matcher.
A matcher is a callable that takes a requests.Request and returns a requests.Response if it matches or None if not.
Parameters: | matcher (callable) – The matcher to execute. |
---|
Bases: requests_mock.exceptions.MockException
This call cannot be made under a mocked environment
Bases: exceptions.Exception
Base Exception for library
Bases: requests_mock.exceptions.MockException
The requested URL was not mocked
Bases: requests.adapters.BaseAdapter, requests_mock.adapter._RequestHistoryTracker
A fake adapter than can return predefined responses.
Register a custom matcher.
A matcher is a callable that takes a requests.Request and returns a requests.Response if it matches or None if not.
Parameters: | matcher (callable) – The matcher to execute. |
---|
Register a new URI match and fake response.
Parameters: |
|
---|
Parameters: |
|
---|
Bases: requests_mock.mocker.MockerCore
The standard entry point for mock Adapter loading.
Returns an exact copy of current mock
Decorates a callable
Parameters: | func (callable) – callable to decorate |
---|
Decorates methods in a class with request_mock
Method will be decorated only if it name begins with TEST_PREFIX
Parameters: | klass (object) – class which methods will be decorated |
---|
Bases: object
A wrapper around common mocking functions.
Automate the process of mocking the requests library. This will keep the same general options available and prevent repeating code.
Start mocking requests.
Install the adapter and the wrappers required to intercept requests.
Stop mocking requests.
This should have no impact if mocking has not been started.
Bases: exceptions.Exception
Base Exception for library
Bases: requests_mock.exceptions.MockException
The requested URL was not mocked