MCPcopy Index your code
hub / github.com/mitmproxy/mitmproxy / test_parse_modify_spec

Function test_parse_modify_spec

test/mitmproxy/addons/test_modifyheaders.py:10–27  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

8
9
10def test_parse_modify_spec():
11 spec = parse_modify_spec("/foo/bar/voing", True)
12 assert spec.matches.pattern == "foo"
13 assert spec.subject == b"bar"
14 assert spec.read_replacement() == b"voing"
15
16 spec = parse_modify_spec("/foo/bar/vo/ing/", False)
17 assert spec.matches.pattern == "foo"
18 assert spec.subject == b"bar"
19 assert spec.read_replacement() == b"vo/ing/"
20
21 spec = parse_modify_spec("/bar/voing", False)
22 assert spec.matches(tflow.tflow())
23 assert spec.subject == b"bar"
24 assert spec.read_replacement() == b"voing"
25
26 with pytest.raises(ValueError, match="Invalid regular expression"):
27 parse_modify_spec("/[/two", True)
28
29
30class TestModifyHeaders:

Callers

nothing calls this directly

Calls 2

parse_modify_specFunction · 0.90
read_replacementMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…