Skip to content

Commit

Permalink
Adjust tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cortesi committed Nov 15, 2014
1 parent 0906ee9 commit 9c88622
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions test/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ def assert_noerr(self, *args):
def test_simple(self):
assert self.p()

def test_confdir(self):
with tutils.tmpdir() as confdir:
self.assert_noerr("--confdir", confdir)
def test_cadir(self):
with tutils.tmpdir() as cadir:
self.assert_noerr("--cadir", cadir)

@mock.patch("libmproxy.platform.resolver", None)
def test_no_transparent(self):
Expand All @@ -94,12 +94,12 @@ def test_modes(self, _):
self.assert_err("mutually exclusive", "-R", "http://localhost", "-T")

def test_client_certs(self):
with tutils.tmpdir() as confdir:
self.assert_noerr("--client-certs", confdir)
with tutils.tmpdir() as cadir:
self.assert_noerr("--client-certs", cadir)
self.assert_err("directory does not exist", "--client-certs", "nonexistent")

def test_certs(self):
with tutils.tmpdir() as confdir:
with tutils.tmpdir() as cadir:
self.assert_noerr("--cert", tutils.test_data.path("data/testkey.pem"))
self.assert_err("does not exist", "--cert", "nonexistent")

Expand Down
6 changes: 3 additions & 3 deletions test/tservers.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def setupAll(cls):

@classmethod
def teardownAll(cls):
shutil.rmtree(cls.confdir)
shutil.rmtree(cls.cadir)
cls.proxy.shutdown()
cls.server.shutdown()
cls.server2.shutdown()
Expand All @@ -116,10 +116,10 @@ def master(self):

@classmethod
def get_proxy_config(cls):
cls.confdir = os.path.join(tempfile.gettempdir(), "mitmproxy")
cls.cadir = os.path.join(tempfile.gettempdir(), "mitmproxy")
return dict(
no_upstream_cert = cls.no_upstream_cert,
confdir = cls.confdir,
cadir = cls.cadir,
authenticator = cls.authenticator,
certforward = cls.certforward,
ssl_ports=([cls.server.port, cls.server2.port] if cls.ssl else []),
Expand Down

0 comments on commit 9c88622

Please sign in to comment.