1
0
mirror of https://github.com/kevin1024/vcrpy.git synced 2025-12-09 01:03:24 +00:00

test_filter.py: Make test_filter_querystring meaner

This commit is contained in:
Sebastian Pipping
2023-07-10 16:18:17 +02:00
parent d2c1da9ab7
commit 8ab8e63e04

View File

@@ -45,13 +45,18 @@ def test_filter_basic_auth(tmpdir, httpbin):
def test_filter_querystring(tmpdir, httpbin): def test_filter_querystring(tmpdir, httpbin):
url = httpbin.url + "/?foo=bar" url = httpbin.url + "/?password=secret"
cass_file = str(tmpdir.join("filter_qs.yaml")) cass_file = str(tmpdir.join("filter_qs.yaml"))
with vcr.use_cassette(cass_file, filter_query_parameters=["foo"]): with vcr.use_cassette(cass_file, filter_query_parameters=["password"]):
urlopen(url) urlopen(url)
with vcr.use_cassette(cass_file, filter_query_parameters=["foo"]) as cass: with vcr.use_cassette(cass_file, filter_query_parameters=["password"]) as cass:
urlopen(url) urlopen(url)
assert "foo" not in cass.requests[0].url assert "password" not in cass.requests[0].url
assert "secret" not in cass.requests[0].url
with open(cass_file) as f:
cassette_content = f.read()
assert "password" not in cassette_content
assert "secret" not in cassette_content
def test_filter_post_data(tmpdir, httpbin): def test_filter_post_data(tmpdir, httpbin):