Ticket #4963: 4963.patch

File 4963.patch, 2.3 KB (added by moijes12, 5 years ago)
  • twisted/mail/test/test_mail.py

     
    20082008
    20092009
    20102010
    2011 
    2012 
    2013 
    20142011class TestDomain:
    20152012    def __init__(self, aliases, users):
    20162013        self.aliases = aliases
     
    20312028            raise smtp.SMTPBadRcpt(user)
    20322029
    20332030
     2031
     2032class SSLContextFactoryTests(unittest.TestCase):
     2033    """
     2034    Tests for twisted.mail.protocols.SSLContextFactory.
     2035    """
     2036
     2037
     2038    def testDeprecation(self):
     2039        """
     2040        Test deprecation of twisted.mail.protocols.SSLContextFactory.
     2041        """
     2042        mail.protocols.SSLContextFactory('')
     2043        warningsShown = self.flushWarnings([self.testDeprecation])
     2044        self.assertEqual(len(warningsShown), 1)
     2045        self.assertIdentical(warningsShown[0]['category'], DeprecationWarning)
     2046        self.assertEqual(warningsShown[0]['message'], 'twisted.mail.protocols.SSLContextFactory was deprecated in Twisted 12.1.0: Use twisted.internet.ssl.DefaultOpenSSLContextFactory instead.')
     2047
    20342048from twisted.python.runtime import platformType
    20352049import types
    20362050if platformType != "posix":
  • twisted/mail/topfiles/4963.removal

     
     1twisted.mail.protocols.SSLContextFactory is now deprecated.
  • twisted/mail/protocols.py

     
    1212from twisted.internet import defer
    1313from twisted.copyright import longversion
    1414from twisted.python import log
     15from twisted.python.deprecate import deprecatedModuleAttribute
     16from twisted.python.versions import Version
    1517
    1618from twisted import cred
    1719import twisted.cred.error
     
    213215   
    214216    This loads a certificate and private key from a specified file.
    215217    """
     218
     219    deprecatedModuleAttribute(Version("Twisted", 12, 1, 0), "Use twisted.internet.ssl.DefaultOpenSSLContextFactory instead.", "twisted.mail.protocols", "SSLContextFactory")
     220
     221
    216222    def __init__(self, filename):
    217223        self.filename = filename
    218224