diff options
author | Miroslav <ttahabatt@gmail.com> | 2018-04-26 01:35:44 +0300 |
---|---|---|
committer | Miroslav <ttahabatt@gmail.com> | 2018-04-26 01:35:44 +0300 |
commit | ea6fab09b5936ee2e1cb90a56f1e337679aefcff (patch) | |
tree | faa0d5a07cd985ff8a4325e8a54a24a81d24f028 /test | |
parent | 5546f0a05ec21db986f0639cee9e89452ba68642 (diff) | |
download | mitmproxy-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.py | 4 |
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): |