8 Commits

Author SHA1 Message Date
Jamie Lennox
fe37c6cc3a Support Cookies
Cookies are treated unusually in requests. To handle them exactly as
requests does we would need to create httplib responses with headers and
pass those back. This would be a significant change that is a little
tricky. Instead use the available requests cookies handlers to merge the
cookies into the responses returned from the adapter.

Provide a way to create and preload a CookieJar that will be returned as
part of responses. We also provide the dict interface that requests
does. We don't really have a lot of choice here as these interfaces are
supported by the cookie apis and we would need to actively work around
things to remove that interface.

Change-Id: Ifc1253abc1b4004e81aa7bffad1faf32aedd0d4c
Closes-Bug: #1480835
2015-11-18 12:00:09 +11:00
Jamie Lennox
35951b0386 Make a public create_response function
We need a way for custom matchers to be able to return fully formed
responses. Make a new function for this and convert the existing
response matchers to use it.
2014-07-30 15:21:21 +10:00
Jamie Lennox
4ae5f15568 Add a mock() function
This is the same as the Mocker() however it looks more correct to do
@requests_mock.mock() rather than @requests_mock.Mocker().

Ideally mock() would be the decorator and Mocker() the context manager
but it doesn't really matter.
2014-07-30 06:40:10 +10:00
Jamie Lennox
96fbd5a0ee Export symbols for HTTP methods
This shouldn't be considered the way to use these methods, using the
strings are fine, but in certain places people don't like using strings
everywhere and so we should have the constants available for them.
2014-07-30 06:28:33 +10:00
Jamie Lennox
833ee180c3 Create the Mocker
A standard means of mock loading the adapter. Because we have this move
fixtures stuff into contrib.

Add some documentation for all this.
2014-06-23 16:03:40 +10:00
Jamie Lennox
5e360fb73c Add the ANY wildcard 2014-06-17 09:56:09 +10:00
Jamie Lennox
e01f313529 Rework ideas
I think it makes more sense to have the adapter be more prominent and
then provide on top a number of was of installing the adapter.

Still not sure on how to provide some concepts like returning a series.
2014-06-14 20:36:04 +10:00
Jamie Lennox
9de0862eed Initial commit
Simple framework with basic testing.
2014-04-10 13:13:07 +10:00