aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMiroslav <ttahabatt@gmail.com>2018-04-26 01:35:44 +0300
committerMiroslav <ttahabatt@gmail.com>2018-04-26 01:35:44 +0300
commitea6fab09b5936ee2e1cb90a56f1e337679aefcff (patch)
treefaa0d5a07cd985ff8a4325e8a54a24a81d24f028 /test
parent5546f0a05ec21db986f0639cee9e89452ba68642 (diff)
downloadmitmproxy-ea6fab09b5936ee2e1cb90a56f1e337679aefcff.tar.gz
mitmproxy-ea6fab09b5936ee2e1cb90a56f1e337679aefcff.tar.bz2
mitmproxy-ea6fab09b5936ee2e1cb90a56f1e337679aefcff.zip
Fix #3002. Auto-expanding
Diffstat (limited to 'test')
-rw-r--r--test/mitmproxy/test_types.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/test/mitmproxy/test_types.py b/test/mitmproxy/test_types.py
index 72492fa9..aafddef1 100644
--- a/test/mitmproxy/test_types.py
+++ b/test/mitmproxy/test_types.py
@@ -2,6 +2,7 @@ import pytest
import os
import typing
import contextlib
+from unittest import mock
from mitmproxy.test import tutils
import mitmproxy.exceptions
@@ -69,7 +70,10 @@ def test_path():
b = mitmproxy.types._PathType()
assert b.parse(tctx.master.commands, mitmproxy.types.Path, "/foo") == "/foo"
assert b.parse(tctx.master.commands, mitmproxy.types.Path, "/bar") == "/bar"
+ with mock.patch.dict("os.environ", {"HOME": "/home/test"}):
+ assert b.parse(tctx.master.commands, mitmproxy.types.Path, "~/mitm") == "/home/test/mitm"
assert b.is_valid(tctx.master.commands, mitmproxy.types.Path, "foo") is True
+ assert b.is_valid(tctx.master.commands, mitmproxy.types.Path, "~/mitm") is True
assert b.is_valid(tctx.master.commands, mitmproxy.types.Path, 3) is False
def normPathOpts(prefix, match):