mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-09 09:13:23 +00:00
aiohttp: Fix code linting
This commit is contained in:
committed by
Kevin McCarthy
parent
9817a8bda5
commit
5242e68cd1
@@ -324,19 +324,19 @@ def test_double_requests(tmpdir):
|
|||||||
|
|
||||||
def test_cookies(scheme, tmpdir):
|
def test_cookies(scheme, tmpdir):
|
||||||
url = scheme + (
|
url = scheme + (
|
||||||
'://httpbin.org/response-headers?'
|
"://httpbin.org/response-headers?"
|
||||||
'set-cookie=' + urllib.parse.quote('cookie_1=val_1; Path=/') + '&'
|
"set-cookie=" + urllib.parse.quote("cookie_1=val_1; Path=/") + "&"
|
||||||
'Set-Cookie=' + urllib.parse.quote('Cookie_2=Val_2; Path=/')
|
"Set-Cookie=" + urllib.parse.quote("Cookie_2=Val_2; Path=/")
|
||||||
)
|
)
|
||||||
with vcr.use_cassette(str(tmpdir.join("cookies.yaml"))) as cassette:
|
with vcr.use_cassette(str(tmpdir.join("cookies.yaml"))) as cassette:
|
||||||
response, _ = get(url, output='json')
|
response, _ = get(url, output="json")
|
||||||
|
|
||||||
assert response.cookies.get('cookie_1').value == 'val_1'
|
assert response.cookies.get("cookie_1").value == "val_1"
|
||||||
assert response.cookies.get('Cookie_2').value == 'Val_2'
|
assert response.cookies.get("Cookie_2").value == "Val_2"
|
||||||
|
|
||||||
with vcr.use_cassette(str(tmpdir.join("cookies.yaml"))) as cassette:
|
with vcr.use_cassette(str(tmpdir.join("cookies.yaml"))) as cassette:
|
||||||
response, _ = get(url, output='json')
|
response, _ = get(url, output="json")
|
||||||
assert cassette.play_count == 1
|
assert cassette.play_count == 1
|
||||||
|
|
||||||
assert response.cookies.get('cookie_1').value == 'val_1'
|
assert response.cookies.get("cookie_1").value == "val_1"
|
||||||
assert response.cookies.get('Cookie_2').value == 'Val_2'
|
assert response.cookies.get("Cookie_2").value == "Val_2"
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ def build_response(vcr_request, vcr_response, history):
|
|||||||
try:
|
try:
|
||||||
response.cookies.load(hdr)
|
response.cookies.load(hdr)
|
||||||
except CookieError as exc:
|
except CookieError as exc:
|
||||||
log.warning('Can not load response cookies: %s', exc)
|
log.warning("Can not load response cookies: %s", exc)
|
||||||
|
|
||||||
response.close()
|
response.close()
|
||||||
return response
|
return response
|
||||||
|
|||||||
Reference in New Issue
Block a user