aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2017-03-24 10:05:37 +1300
committerGitHub <noreply@github.com>2017-03-24 10:05:37 +1300
commit439c113989feb193972b83ffcd0823ea4d2218df (patch)
tree7c37103eef09058af2a637bc5d74a3267397bb86 /test
parent3a35c69986b0b085853cabba0decdf75601d11b3 (diff)
parent0d3e2c6adff0479c42dc28880cd0258d32958fc2 (diff)
downloadmitmproxy-439c113989feb193972b83ffcd0823ea4d2218df.tar.gz
mitmproxy-439c113989feb193972b83ffcd0823ea4d2218df.tar.bz2
mitmproxy-439c113989feb193972b83ffcd0823ea4d2218df.zip
Merge pull request #2204 from cortesi/consoleopts
console options: load and save options to and from file
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_optmanager.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/mitmproxy/test_optmanager.py b/test/mitmproxy/test_optmanager.py
index 01636640..31b6e52b 100644
--- a/test/mitmproxy/test_optmanager.py
+++ b/test/mitmproxy/test_optmanager.py
@@ -296,6 +296,20 @@ def test_saving(tmpdir):
with pytest.raises(exceptions.OptionsError):
optmanager.load_paths(o, dst)
+ with open(dst, 'wb') as f:
+ f.write(b"\x01\x02\x03")
+ with pytest.raises(exceptions.OptionsError):
+ optmanager.load_paths(o, dst)
+ with pytest.raises(exceptions.OptionsError):
+ optmanager.save(o, dst)
+
+ with open(dst, 'wb') as f:
+ f.write(b"\xff\xff\xff")
+ with pytest.raises(exceptions.OptionsError):
+ optmanager.load_paths(o, dst)
+ with pytest.raises(exceptions.OptionsError):
+ optmanager.save(o, dst)
+
def test_merge():
m = TM()