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

Function test_options

test/mitmproxy/addons/test_core.py:129–156  ·  view source on GitHub ↗
(tmpdir)

Source from the content-addressed store, hash-verified

127
128
129def test_options(tmpdir):
130 p = str(tmpdir.join("path"))
131 sa = core.Core()
132 with taddons.context() as tctx:
133 tctx.options.listen_host = "foo"
134 assert tctx.options.listen_host == "foo"
135 sa.options_reset_one("listen_host")
136 assert tctx.options.listen_host != "foo"
137
138 with pytest.raises(exceptions.CommandError):
139 sa.options_reset_one("unknown")
140
141 tctx.options.listen_host = "foo"
142 sa.options_save(p)
143 with pytest.raises(exceptions.CommandError):
144 sa.options_save("/")
145
146 sa.options_reset()
147 assert tctx.options.listen_host == ""
148 sa.options_load(p)
149 assert tctx.options.listen_host == "foo"
150
151 sa.options_load("/nonexistent")
152
153 with open(p, "a") as f:
154 f.write("'''")
155 with pytest.raises(exceptions.CommandError):
156 sa.options_load(p)
157
158
159def test_validation_simple():

Callers

nothing calls this directly

Calls 7

options_reset_oneMethod · 0.95
options_saveMethod · 0.95
options_resetMethod · 0.95
options_loadMethod · 0.95
contextMethod · 0.80
joinMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…