From 63179d97511519ce0ba4384b2c6849ba96748d88 Mon Sep 17 00:00:00 2001 From: Maximilian Hils Date: Wed, 8 Mar 2017 15:17:07 +0100 Subject: [PATCH] core -> core_option_validation longer, but much clearer for devs who are unfamiliar with the codebase. --- mitmproxy/addons/__init__.py | 4 ++-- mitmproxy/addons/{core.py => core_option_validation.py} | 2 +- .../{test_core.py => test_core_option_validation.py} | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) rename mitmproxy/addons/{core.py => core_option_validation.py} (98%) rename test/mitmproxy/addons/{test_core.py => test_core_option_validation.py} (86%) diff --git a/mitmproxy/addons/__init__.py b/mitmproxy/addons/__init__.py index 1bf89bbba..165106403 100644 --- a/mitmproxy/addons/__init__.py +++ b/mitmproxy/addons/__init__.py @@ -3,7 +3,7 @@ from mitmproxy.addons import anticomp from mitmproxy.addons import check_alpn from mitmproxy.addons import check_ca from mitmproxy.addons import clientplayback -from mitmproxy.addons import core +from mitmproxy.addons import core_option_validation from mitmproxy.addons import disable_h2c_upgrade from mitmproxy.addons import onboarding from mitmproxy.addons import proxyauth @@ -20,7 +20,7 @@ from mitmproxy.addons import upstream_auth def default_addons(): return [ - core.Core(), + core_option_validation.CoreOptionValidation(), anticache.AntiCache(), anticomp.AntiComp(), check_alpn.CheckALPN(), diff --git a/mitmproxy/addons/core.py b/mitmproxy/addons/core_option_validation.py similarity index 98% rename from mitmproxy/addons/core.py rename to mitmproxy/addons/core_option_validation.py index 4c6a55168..fd5f27880 100644 --- a/mitmproxy/addons/core.py +++ b/mitmproxy/addons/core_option_validation.py @@ -8,7 +8,7 @@ from mitmproxy.net import server_spec from mitmproxy.utils import human -class Core: +class CoreOptionValidation: def configure(self, opts, updated): if opts.add_upstream_certs_to_client_chain and not opts.upstream_cert: raise exceptions.OptionsError( diff --git a/test/mitmproxy/addons/test_core.py b/test/mitmproxy/addons/test_core_option_validation.py similarity index 86% rename from test/mitmproxy/addons/test_core.py rename to test/mitmproxy/addons/test_core_option_validation.py index db739b5de..0bb2bb0d7 100644 --- a/test/mitmproxy/addons/test_core.py +++ b/test/mitmproxy/addons/test_core_option_validation.py @@ -1,12 +1,12 @@ from mitmproxy import exceptions -from mitmproxy.addons import core +from mitmproxy.addons import core_option_validation from mitmproxy.test import taddons import pytest from unittest import mock def test_simple(): - sa = core.Core() + sa = core_option_validation.CoreOptionValidation() with taddons.context() as tctx: with pytest.raises(exceptions.OptionsError): tctx.configure(sa, body_size_limit = "invalid") @@ -28,7 +28,7 @@ def test_simple(): @mock.patch("mitmproxy.platform.original_addr", None) def test_no_transparent(): - sa = core.Core() + sa = core_option_validation.CoreOptionValidation() with taddons.context() as tctx: with pytest.raises(Exception, match="Transparent mode not supported"): tctx.configure(sa, mode = "transparent") @@ -36,7 +36,7 @@ def test_no_transparent(): @mock.patch("mitmproxy.platform.original_addr") def test_modes(m): - sa = core.Core() + sa = core_option_validation.CoreOptionValidation() with taddons.context() as tctx: tctx.configure(sa, mode = "reverse:http://localhost") with pytest.raises(Exception, match="Invalid server specification"):