Skip to content

Commit 5c2e1f4

Browse files
committed
Change back to ftplib.FTP_TLS:certfile as :context is not supported on Travis
1 parent 6b4aae7 commit 5c2e1f4

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

pyftpdlib/test/test_functional_ssl.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -450,18 +450,9 @@ def assertRaisesWithMsg(self, excClass, msg, callableObj, *args, **kwargs):
450450
excName = str(excClass)
451451
raise self.failureException("%s not raised" % excName)
452452

453-
@classmethod
454-
def get_ssl_context(cls, certfile):
455-
ssl_context = ssl.create_default_context()
456-
ssl_context.check_hostname = False
457-
ssl_context.verify_mode = ssl.CERT_NONE
458-
if certfile:
459-
ssl_context.load_cert_chain(certfile)
460-
return ssl_context
461-
462453
def test_auth_client_cert(self):
463-
ctx = self.get_ssl_context(CLIENT_CERTFILE)
464-
self.client = ftplib.FTP_TLS(timeout=TIMEOUT, context=ctx)
454+
self.client = ftplib.FTP_TLS(timeout=TIMEOUT,
455+
certfile=CLIENT_CERTFILE)
465456
self.client.connect(self.server.host, self.server.port)
466457
# secured
467458
try:
@@ -485,8 +476,7 @@ def test_auth_client_nocert(self):
485476
self.fail("Client able to log in with no certificate")
486477

487478
def test_auth_client_badcert(self):
488-
ctx = self.get_ssl_context(CERTFILE)
489-
self.client = ftplib.FTP_TLS(timeout=TIMEOUT, context=ctx)
479+
self.client = ftplib.FTP_TLS(timeout=TIMEOUT, certfile=CERTFILE)
490480
self.client.connect(self.server.host, self.server.port)
491481
try:
492482
self.client.login()

0 commit comments

Comments
 (0)