mirror of
https://github.com/kevin1024/vcrpy.git
synced 2025-12-10 09:35:34 +00:00
use context manager for requests.Session
This commit is contained in:
@@ -63,7 +63,7 @@ def test_flickr_should_respond_with_200(tmpdir):
|
|||||||
def test_cookies(tmpdir, httpbin):
|
def test_cookies(tmpdir, httpbin):
|
||||||
testfile = str(tmpdir.join("cookies.yml"))
|
testfile = str(tmpdir.join("cookies.yml"))
|
||||||
with vcr.use_cassette(testfile):
|
with vcr.use_cassette(testfile):
|
||||||
s = requests.Session()
|
with requests.Session() as s:
|
||||||
s.get(httpbin.url + "/cookies/set?k1=v1&k2=v2")
|
s.get(httpbin.url + "/cookies/set?k1=v1&k2=v2")
|
||||||
assert s.cookies.keys() == ["k1", "k2"]
|
assert s.cookies.keys() == ["k1", "k2"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user