mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 17:15:35 +00:00
Merge pull request #65 from msabramo/patch-1
README.md: minor formatting, add links
This commit is contained in:
18
README.md
18
README.md
@@ -32,7 +32,7 @@ with vcr.use_cassette('fixtures/vcr_cassettes/synopsis.yaml'):
|
||||
assert 'Example domains' in response
|
||||
```
|
||||
|
||||
Run this test once, and VCR.py will record the http request to
|
||||
Run this test once, and VCR.py will record the HTTP request to
|
||||
`fixtures/vcr_cassettes/synopsis.yml`. Run it again, and VCR.py will replay the
|
||||
response from iana.org when the http request is made. This test is now fast (no
|
||||
real HTTP requests are made anymore), deterministic (the test will continue to
|
||||
@@ -42,7 +42,7 @@ real request).
|
||||
|
||||
You can also use VCR.py as a decorator. The same request above would look like this:
|
||||
|
||||
```
|
||||
```python
|
||||
@vcr.use_cassette('fixtures/vcr_cassettes/synopsis.yaml'):
|
||||
def test_iana():
|
||||
response = urllib2.urlopen('http://www.iana.org/domains/reserved').read()
|
||||
@@ -54,7 +54,7 @@ All of the parameters and configuration works the same for the decorator version
|
||||
## Configuration
|
||||
|
||||
If you don't like VCR's defaults, you can set options by instantiating a
|
||||
VCR class and setting the options on it.
|
||||
`VCR` class and setting the options on it.
|
||||
|
||||
```python
|
||||
|
||||
@@ -164,7 +164,7 @@ with vcr.use_cassette('fixtures/vcr_cassettes/synopsis.yaml') as cass:
|
||||
assert cass.requests[0].url == 'http://www.zombo.com/'
|
||||
```
|
||||
|
||||
The Cassette object exposes the following properties which I consider
|
||||
The `Cassette` object exposes the following properties which I consider
|
||||
part of the API. The fields are as follows:
|
||||
|
||||
* `requests`: A list of vcr.Request objects containing the requests made
|
||||
@@ -175,7 +175,7 @@ part of the API. The fields are as follows:
|
||||
played back
|
||||
* `responses_of(request)`: Access the responses that match a given request
|
||||
|
||||
The Request object has the following properties
|
||||
The `Request` object has the following properties
|
||||
|
||||
* `URL`: The full url of the request, including the protocol. Example: "http://www.google.com/"
|
||||
* `path`: The path of the request. For example "/" or "/home.html"
|
||||
@@ -228,8 +228,8 @@ Create your own method with the following signature
|
||||
def my_matcher(r1, r2):
|
||||
```
|
||||
|
||||
Your method receives the two requests and must return True if they
|
||||
match, False if they don't.
|
||||
Your method receives the two requests and must return `True` if they
|
||||
match, `False` if they don't.
|
||||
|
||||
Finally, register your method with VCR to use your
|
||||
new request matcher.
|
||||
@@ -265,11 +265,11 @@ Ruby's VCR are not compatible with VCR.py.
|
||||
|
||||
## Running VCR's test suite
|
||||
|
||||
The tests are all run automatically on Travis, but you can also run them yourself using py.test and Tox. Tox will automatically run them in all environments VCR.py supports. The test suite is pretty big and slow, but you can tell tox to only run specific tests like this:
|
||||
The tests are all run automatically on [Travis CI](https://travis-ci.org/kevin1024/vcrpy), but you can also run them yourself using [py.test](http://pytest.org/) and [Tox](http://tox.testrun.org/). Tox will automatically run them in all environments VCR.py supports. The test suite is pretty big and slow, but you can tell tox to only run specific tests like this:
|
||||
|
||||
`tox -e py27requests -- -v -k "'test_status_code or test_gzip'"`
|
||||
|
||||
This will run only tests that look like `test_status_code` or `test_gzip` in the test suite, and only in the python 2.7 environment that has requests installed.
|
||||
This will run only tests that look like `test_status_code` or `test_gzip` in the test suite, and only in the python 2.7 environment that has `requests` installed.
|
||||
|
||||
## Known Issues
|
||||
This library is a work in progress, so the API might change on you.
|
||||
|
||||
Reference in New Issue
Block a user