コード例 #1
0
ファイル: test_script.py プロジェクト: yoavweiss/mitmproxy
    def test_no_script_file(self):
        with pytest.raises(Exception, match="not found"):
            script.parse_command("notfound")

        with tutils.tmpdir() as dir:
            with pytest.raises(Exception, match="Not a file"):
                script.parse_command(dir)
コード例 #2
0
    def test_no_script_file(self):
        with tutils.raises("not found"):
            script.parse_command("notfound")

        with tutils.tmpdir() as dir:
            with tutils.raises("not a file"):
                script.parse_command(dir)
コード例 #3
0
ファイル: test_script.py プロジェクト: s4chin/mitmproxy
    def test_no_script_file(self):
        with pytest.raises(Exception, match="not found"):
            script.parse_command("notfound")

        with tutils.tmpdir() as dir:
            with pytest.raises(Exception, match="Not a file"):
                script.parse_command(dir)
コード例 #4
0
ファイル: test_script.py プロジェクト: f0r34chb3t4/mitmproxy
    def test_no_script_file(self):
        with tutils.raises("not found"):
            script.parse_command("notfound")

        with tutils.tmpdir() as dir:
            with tutils.raises("not a file"):
                script.parse_command(dir)
コード例 #5
0
 def test_parse_windows(self):
     with tutils.chdir(tutils.test_data.dirname):
         assert script.parse_command("data\\addonscripts\\recorder.py") == (
             "data\\addonscripts\\recorder.py", [])
         assert script.parse_command(
             "data\\addonscripts\\recorder.py 'foo \\ bar'") == (
                 "data\\addonscripts\\recorder.py", ['foo \\ bar'])
コード例 #6
0
ファイル: test_script.py プロジェクト: f0r34chb3t4/mitmproxy
 def test_parse_windows(self):
     with tutils.chdir(tutils.test_data.dirname):
         assert script.parse_command(
             "mitmproxy/data\\addonscripts\\recorder.py"
         ) == ("mitmproxy/data\\addonscripts\\recorder.py", [])
         assert script.parse_command(
             "mitmproxy/data\\addonscripts\\recorder.py 'foo \\ bar'"
         ) == ("mitmproxy/data\\addonscripts\\recorder.py", ['foo \\ bar'])
コード例 #7
0
 def test_parse_args(self):
     with tutils.chdir(tutils.test_data.dirname):
         assert script.parse_command("data/addonscripts/recorder.py") == (
             "data/addonscripts/recorder.py", [])
         assert script.parse_command("data/addonscripts/recorder.py foo bar"
                                     ) == ("data/addonscripts/recorder.py",
                                           ["foo", "bar"])
         assert script.parse_command(
             "data/addonscripts/recorder.py 'foo bar'") == (
                 "data/addonscripts/recorder.py", ["foo bar"])
コード例 #8
0
ファイル: test_script.py プロジェクト: f0r34chb3t4/mitmproxy
 def test_parse_args(self):
     with tutils.chdir(tutils.test_data.dirname):
         assert script.parse_command(
             "mitmproxy/data/addonscripts/recorder.py"
         ) == ("mitmproxy/data/addonscripts/recorder.py", [])
         assert script.parse_command(
             "mitmproxy/data/addonscripts/recorder.py foo bar"
         ) == ("mitmproxy/data/addonscripts/recorder.py", ["foo", "bar"])
         assert script.parse_command(
             "mitmproxy/data/addonscripts/recorder.py 'foo bar'"
         ) == ("mitmproxy/data/addonscripts/recorder.py", ["foo bar"])
コード例 #9
0
    def test_empty_command(self):
        with tutils.raises(exceptions.AddonError):
            script.parse_command("")

        with tutils.raises(exceptions.AddonError):
            script.parse_command("  ")
コード例 #10
0
ファイル: test_script.py プロジェクト: yeaxxx/mitmproxy
    def test_no_script_file(self, tmpdir):
        with pytest.raises(Exception, match="not found"):
            script.parse_command("notfound")

        with pytest.raises(Exception, match="Not a file"):
            script.parse_command(str(tmpdir))
コード例 #11
0
ファイル: test_script.py プロジェクト: yeaxxx/mitmproxy
    def test_empty_command(self):
        with pytest.raises(ValueError):
            script.parse_command("")

        with pytest.raises(ValueError):
            script.parse_command("  ")
コード例 #12
0
ファイル: editors.py プロジェクト: syahn/mitmproxy
 def is_error(self, col, val):
     try:
         script.parse_command(val)
     except exceptions.OptionsError as e:
         return str(e)
コード例 #13
0
ファイル: test_script.py プロジェクト: f0r34chb3t4/mitmproxy
    def test_empty_command(self):
        with tutils.raises(exceptions.AddonError):
            script.parse_command("")

        with tutils.raises(exceptions.AddonError):
            script.parse_command("  ")
コード例 #14
0
ファイル: editors.py プロジェクト: MatthewShao/mitmproxy
 def is_error(self, col, val):
     try:
         script.parse_command(val)
     except exceptions.AddonError as e:
         return str(e)
コード例 #15
0
ファイル: test_script.py プロジェクト: dwfreed/mitmproxy
    def test_empty_command(self):
        with tutils.raises(ValueError):
            script.parse_command("")

        with tutils.raises(ValueError):
            script.parse_command("  ")