From ea6fab09b5936ee2e1cb90a56f1e337679aefcff Mon Sep 17 00:00:00 2001 From: Miroslav Date: Thu, 26 Apr 2018 01:35:44 +0300 Subject: Fix #3002. Auto-expanding --- test/mitmproxy/test_types.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'test') 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): -- cgit v1.2.3