aboutsummaryrefslogtreecommitdiffstats
path: root/test/mitmproxy/addons/test_core.py
blob: 6ebf4ba987a9ca8f6d9eb01cfd21b8c3bc8dd370 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from mitmproxy.addons import core
from mitmproxy.test import taddons
from mitmproxy import exceptions
import pytest


def test_set():
    sa = core.Core()
    with taddons.context() as tctx:
        tctx.master.addons.add(sa)

        assert not tctx.master.options.anticomp
        tctx.command(sa.set, "anticomp")
        assert tctx.master.options.anticomp

        with pytest.raises(exceptions.CommandError):
            tctx.command(sa.set, "nonexistent")