moved addon for selenium authentication to examples/complex.
Co-authored-by: weichweich <14820950+weichweich@users.noreply.github.com>
This commit is contained in:
parent
7dd98b4959
commit
7f89a70edf
|
@ -7,7 +7,7 @@ from mitmproxy.test import tflow
|
||||||
from mitmproxy.test import tutils
|
from mitmproxy.test import tutils
|
||||||
from mitmproxy.http import HTTPFlow
|
from mitmproxy.http import HTTPFlow
|
||||||
|
|
||||||
from mitmproxy.addons.proxyauth_selenium import logger, randomString, AuthorizationOracle, SeleniumAddon
|
from examples.complex.proxyauth_selenium import logger, randomString, AuthorizationOracle, SeleniumAddon
|
||||||
|
|
||||||
|
|
||||||
class TestRandomString:
|
class TestRandomString:
|
||||||
|
@ -79,7 +79,7 @@ class TestSeleniumAddon:
|
||||||
selenium_addon.set_cookies = False
|
selenium_addon.set_cookies = False
|
||||||
assert not selenium_addon.set_cookies
|
assert not selenium_addon.set_cookies
|
||||||
with mock.patch.object(logger, 'debug') as mock_debug:
|
with mock.patch.object(logger, 'debug') as mock_debug:
|
||||||
with mock.patch('mitmproxy.addons.proxyauth_selenium.SeleniumAddon.login',
|
with mock.patch('examples.complex.proxyauth_selenium.SeleniumAddon.login',
|
||||||
return_value=[{"name": "cookie", "value": "test"}]) as mock_login:
|
return_value=[{"name": "cookie", "value": "test"}]) as mock_login:
|
||||||
selenium_addon.request(f)
|
selenium_addon.request(f)
|
||||||
mock_debug.assert_called()
|
mock_debug.assert_called()
|
||||||
|
@ -104,7 +104,7 @@ class TestSeleniumAddon:
|
||||||
f = tflow.tflow(resp=tutils.tresp())
|
f = tflow.tflow(resp=tutils.tresp())
|
||||||
f.request.url = "http://example.com/login.php"
|
f.request.url = "http://example.com/login.php"
|
||||||
selenium_addon.set_cookies = False
|
selenium_addon.set_cookies = False
|
||||||
with mock.patch('mitmproxy.addons.proxyauth_selenium.SeleniumAddon.login', return_value=[]) as mock_login:
|
with mock.patch('examples.complex.proxyauth_selenium.SeleniumAddon.login', return_value=[]) as mock_login:
|
||||||
selenium_addon.response(f)
|
selenium_addon.response(f)
|
||||||
mock_login.assert_called()
|
mock_login.assert_called()
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ class TestSeleniumAddon:
|
||||||
f = tflow.tflow(resp=tutils.tresp())
|
f = tflow.tflow(resp=tutils.tresp())
|
||||||
f.request.url = "http://example.com/login.php"
|
f.request.url = "http://example.com/login.php"
|
||||||
selenium_addon.set_cookies = False
|
selenium_addon.set_cookies = False
|
||||||
with mock.patch('mitmproxy.addons.proxyauth_selenium.SeleniumAddon.login',
|
with mock.patch('examples.complex.proxyauth_selenium.SeleniumAddon.login',
|
||||||
return_value=[{"name": "cookie", "value": "test"}]) as mock_login:
|
return_value=[{"name": "cookie", "value": "test"}]) as mock_login:
|
||||||
selenium_addon.response(f)
|
selenium_addon.response(f)
|
||||||
mock_login.assert_called()
|
mock_login.assert_called()
|
Loading…
Reference in New Issue