mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 01:03:24 +00:00
pre-commit: Mass-apply trailing-whitespace
This commit is contained in:
2
.github/workflows/docs.yml
vendored
2
.github/workflows/docs.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: "3.12"
|
python-version: "3.12"
|
||||||
|
|
||||||
- name: Install build dependencies
|
- name: Install build dependencies
|
||||||
run: pip install -r docs/requirements.txt
|
run: pip install -r docs/requirements.txt
|
||||||
- name: Rendering HTML documentation
|
- name: Rendering HTML documentation
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ a nice addition. Here's an example:
|
|||||||
with vcr.use_cassette('fixtures/vcr_cassettes/synopsis.yaml') as cass:
|
with vcr.use_cassette('fixtures/vcr_cassettes/synopsis.yaml') as cass:
|
||||||
response = urllib2.urlopen('http://www.zombo.com/').read()
|
response = urllib2.urlopen('http://www.zombo.com/').read()
|
||||||
# cass should have 1 request inside it
|
# cass should have 1 request inside it
|
||||||
assert len(cass) == 1
|
assert len(cass) == 1
|
||||||
# the request uri should have been http://www.zombo.com/
|
# the request uri should have been http://www.zombo.com/
|
||||||
assert cass.requests[0].uri == 'http://www.zombo.com/'
|
assert cass.requests[0].uri == 'http://www.zombo.com/'
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ So these two calls are the same:
|
|||||||
|
|
||||||
# original (still works)
|
# original (still works)
|
||||||
vcr = VCR(filter_headers=['authorization'])
|
vcr = VCR(filter_headers=['authorization'])
|
||||||
|
|
||||||
# new
|
# new
|
||||||
vcr = VCR(filter_headers=[('authorization', None)])
|
vcr = VCR(filter_headers=[('authorization', None)])
|
||||||
|
|
||||||
@@ -218,7 +218,7 @@ Here are two examples of the new functionality:
|
|||||||
|
|
||||||
# replace with a static value (most common)
|
# replace with a static value (most common)
|
||||||
vcr = VCR(filter_headers=[('authorization', 'XXXXXX')])
|
vcr = VCR(filter_headers=[('authorization', 'XXXXXX')])
|
||||||
|
|
||||||
# replace with a callable, for example when testing
|
# replace with a callable, for example when testing
|
||||||
# lots of different kinds of authorization.
|
# lots of different kinds of authorization.
|
||||||
def replace_auth(key, value, request):
|
def replace_auth(key, value, request):
|
||||||
@@ -286,7 +286,7 @@ sensitive data from the response body:
|
|||||||
before_record_response=scrub_string(settings.USERNAME, 'username'),
|
before_record_response=scrub_string(settings.USERNAME, 'username'),
|
||||||
)
|
)
|
||||||
with my_vcr.use_cassette('test.yml'):
|
with my_vcr.use_cassette('test.yml'):
|
||||||
# your http code here
|
# your http code here
|
||||||
|
|
||||||
|
|
||||||
Decode compressed response
|
Decode compressed response
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# https://blog.ionelmc.ro/2015/04/14/tox-tricks-and-patterns/#when-it-inevitably-leads-to-shell-scripts
|
# https://blog.ionelmc.ro/2015/04/14/tox-tricks-and-patterns/#when-it-inevitably-leads-to-shell-scripts
|
||||||
# If you are getting an INVOCATION ERROR for this script then there is
|
# If you are getting an INVOCATION ERROR for this script then there is
|
||||||
# a good chance you are running on Windows.
|
# a good chance you are running on Windows.
|
||||||
# You can and should use WSL for running tox on Windows when it calls bash scripts.
|
# You can and should use WSL for running tox on Windows when it calls bash scripts.
|
||||||
REQUESTS_CA_BUNDLE=`python3 -m pytest_httpbin.certs` exec pytest "$@"
|
REQUESTS_CA_BUNDLE=`python3 -m pytest_httpbin.certs` exec pytest "$@"
|
||||||
|
|||||||
6
tests/fixtures/migration/new_cassette.json
vendored
6
tests/fixtures/migration/new_cassette.json
vendored
@@ -15,9 +15,9 @@
|
|||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"status": {
|
"status": {
|
||||||
"message": "OK",
|
"message": "OK",
|
||||||
"code": 200
|
"code": 200
|
||||||
},
|
},
|
||||||
"headers": {
|
"headers": {
|
||||||
"access-control-allow-origin": ["*"],
|
"access-control-allow-origin": ["*"],
|
||||||
"content-type": ["application/json"],
|
"content-type": ["application/json"],
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
"server": ["gunicorn/0.17.4"],
|
"server": ["gunicorn/0.17.4"],
|
||||||
"content-length": ["32"],
|
"content-length": ["32"],
|
||||||
"connection": ["keep-alive"]
|
"connection": ["keep-alive"]
|
||||||
},
|
},
|
||||||
"body": {
|
"body": {
|
||||||
"string": "{\n \"origin\": \"217.122.164.194\"\n}"
|
"string": "{\n \"origin\": \"217.122.164.194\"\n}"
|
||||||
}
|
}
|
||||||
|
|||||||
2
tests/fixtures/migration/new_cassette.yaml
vendored
2
tests/fixtures/migration/new_cassette.yaml
vendored
@@ -2,7 +2,7 @@ version: 1
|
|||||||
interactions:
|
interactions:
|
||||||
- request:
|
- request:
|
||||||
body: null
|
body: null
|
||||||
headers:
|
headers:
|
||||||
accept: ['*/*']
|
accept: ['*/*']
|
||||||
accept-encoding: ['gzip, deflate, compress']
|
accept-encoding: ['gzip, deflate, compress']
|
||||||
user-agent: ['python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0']
|
user-agent: ['python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0']
|
||||||
|
|||||||
34
tests/fixtures/migration/old_cassette.json
vendored
34
tests/fixtures/migration/old_cassette.json
vendored
@@ -1,31 +1,31 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"request": {
|
"request": {
|
||||||
"body": null,
|
"body": null,
|
||||||
"protocol": "http",
|
"protocol": "http",
|
||||||
"method": "GET",
|
"method": "GET",
|
||||||
"headers": {
|
"headers": {
|
||||||
"accept-encoding": "gzip, deflate, compress",
|
"accept-encoding": "gzip, deflate, compress",
|
||||||
"accept": "*/*",
|
"accept": "*/*",
|
||||||
"user-agent": "python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0"
|
"user-agent": "python-requests/2.2.1 CPython/2.6.1 Darwin/10.8.0"
|
||||||
},
|
},
|
||||||
"host": "httpbin.org",
|
"host": "httpbin.org",
|
||||||
"path": "/ip",
|
"path": "/ip",
|
||||||
"port": 80
|
"port": 80
|
||||||
},
|
},
|
||||||
"response": {
|
"response": {
|
||||||
"status": {
|
"status": {
|
||||||
"message": "OK",
|
"message": "OK",
|
||||||
"code": 200
|
"code": 200
|
||||||
},
|
},
|
||||||
"headers": [
|
"headers": [
|
||||||
"access-control-allow-origin: *\r\n",
|
"access-control-allow-origin: *\r\n",
|
||||||
"content-type: application/json\r\n",
|
"content-type: application/json\r\n",
|
||||||
"date: Mon, 21 Apr 2014 23:13:40 GMT\r\n",
|
"date: Mon, 21 Apr 2014 23:13:40 GMT\r\n",
|
||||||
"server: gunicorn/0.17.4\r\n",
|
"server: gunicorn/0.17.4\r\n",
|
||||||
"content-length: 32\r\n",
|
"content-length: 32\r\n",
|
||||||
"connection: keep-alive\r\n"
|
"connection: keep-alive\r\n"
|
||||||
],
|
],
|
||||||
"body": {
|
"body": {
|
||||||
"string": "{\n \"origin\": \"217.122.164.194\"\n}"
|
"string": "{\n \"origin\": \"217.122.164.194\"\n}"
|
||||||
}
|
}
|
||||||
|
|||||||
2
tests/fixtures/wild/domain_redirect.yaml
vendored
2
tests/fixtures/wild/domain_redirect.yaml
vendored
@@ -10,7 +10,7 @@ interactions:
|
|||||||
uri: http://seomoz.org/
|
uri: http://seomoz.org/
|
||||||
response:
|
response:
|
||||||
body: {string: ''}
|
body: {string: ''}
|
||||||
headers:
|
headers:
|
||||||
Location: ['http://moz.com/']
|
Location: ['http://moz.com/']
|
||||||
Server: ['BigIP']
|
Server: ['BigIP']
|
||||||
Connection: ['Keep-Alive']
|
Connection: ['Keep-Alive']
|
||||||
|
|||||||
Reference in New Issue
Block a user