當前位置: 首頁>>代碼示例>>Python>>正文


Python tap.Options類代碼示例

本文整理匯總了Python中twisted.mail.tap.Options的典型用法代碼示例。如果您正苦於以下問題:Python Options類的具體用法?Python Options怎麽用?Python Options使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Options類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _endpointTest

 def _endpointTest(self, service):
     """
     Use L{Options} to parse a single service configuration parameter and
     verify that an endpoint of the correct type is added to the list for
     that service.
     """
     options = Options()
     options.parseOptions(['--' + service, 'tcp:1234'])
     self.assertEqual(len(options[service]), 1)
     self.assertIsInstance(
         options[service][0], endpoints.TCP4ServerEndpoint)
開發者ID:antong,項目名稱:twisted,代碼行數:11,代碼來源:test_options.py

示例2: test_auth

 def test_auth(self):
     """
     Tests that the --auth option registers a checker.
     """
     options = Options()
     options.parseOptions(['--auth', 'memory:admin:admin:bob:password'])
     self.assertEqual(len(options['credCheckers']), 1)
     checker = options['credCheckers'][0]
     interfaces = checker.credentialInterfaces
     registered_checkers = options.service.smtpPortal.checkers
     for iface in interfaces:
         self.assertEqual(checker, registered_checkers[iface])
開發者ID:12019,項目名稱:OpenWrt_Luci_Lua,代碼行數:12,代碼來源:test_options.py

示例3: testPasswordfileDeprecation

 def testPasswordfileDeprecation(self):
     """
     Test that the --passwordfile option will emit a correct warning.
     """
     options = Options()
     options.opt_passwordfile('/dev/null')
     warnings = self.flushWarnings([self.testPasswordfileDeprecation])
     self.assertEquals(warnings[0]['category'], DeprecationWarning)
     self.assertEquals(len(warnings), 1)
     msg = deprecate.getDeprecationWarningString(options.opt_passwordfile,
                          versions.Version('twisted.mail', 11, 0, 0))
     self.assertEquals(warnings[0]['message'], msg)
開發者ID:williamsjj,項目名稱:twisted,代碼行數:12,代碼來源:test_options.py

示例4: testPasswordfileDeprecation

 def testPasswordfileDeprecation(self):
     """
     Test that the --passwordfile option will emit a correct warning.
     """
     passwd = FilePath(self.mktemp())
     passwd.setContent("")
     options = Options()
     options.opt_passwordfile(passwd.path)
     warnings = self.flushWarnings([self.testPasswordfileDeprecation])
     self.assertEqual(warnings[0]['category'], DeprecationWarning)
     self.assertEqual(len(warnings), 1)
     msg = deprecate.getDeprecationWarningString(options.opt_passwordfile,
                          versions.Version('twisted.mail', 11, 0, 0))
     self.assertEqual(warnings[0]['message'], msg)
開發者ID:antong,項目名稱:twisted,代碼行數:14,代碼來源:test_options.py

示例5: test_protoDisable

    def test_protoDisable(self):
        """
        The I{--no-pop3} and I{--no-smtp} options disable POP3 and SMTP
        respectively.
        """
        options = Options()
        options.parseOptions(['--no-pop3'])
        self.assertEqual(options._getEndpoints(None, 'pop3'), [])
        self.assertNotEquals(options._getEndpoints(None, 'smtp'), [])

        options = Options()
        options.parseOptions(['--no-smtp'])
        self.assertNotEquals(options._getEndpoints(None, 'pop3'), [])
        self.assertEqual(options._getEndpoints(None, 'smtp'), [])
開發者ID:antong,項目名稱:twisted,代碼行數:14,代碼來源:test_options.py

示例6: test_protoDefaults

    def test_protoDefaults(self):
        """
        POP3 and SMTP each listen on a TCP4ServerEndpoint by default.
        """
        options = Options()
        options.parseOptions([])

        self.assertEqual(len(options['pop3']), 1)
        self.assertIsInstance(
            options['pop3'][0], endpoints.TCP4ServerEndpoint)

        self.assertEqual(len(options['smtp']), 1)
        self.assertIsInstance(
            options['smtp'][0], endpoints.TCP4ServerEndpoint)
開發者ID:antong,項目名稱:twisted,代碼行數:14,代碼來源:test_options.py

示例7: test_barePort

 def test_barePort(self):
     """
     A bare port passed to I{--pop3} results in deprecation warning in
     addition to a TCP4ServerEndpoint.
     """
     options = Options()
     options.parseOptions(['--pop3', '8110'])
     self.assertEqual(len(options['pop3']), 1)
     self.assertIsInstance(
         options['pop3'][0], endpoints.TCP4ServerEndpoint)
     warnings = self.flushWarnings([options.opt_pop3])
     self.assertEqual(len(warnings), 1)
     self.assertEqual(warnings[0]['category'], DeprecationWarning)
     self.assertEqual(
         warnings[0]['message'],
         "Specifying plain ports and/or a certificate is deprecated since "
         "Twisted 11.0; use endpoint descriptions instead.")
開發者ID:antong,項目名稱:twisted,代碼行數:17,代碼來源:test_options.py

示例8: test_pop3sBackwardCompatibility

    def test_pop3sBackwardCompatibility(self):
        """
        The deprecated I{--pop3s} and I{--certificate} options set up a POP3 SSL
        server.
        """
        cert = FilePath(__file__).sibling("server.pem")
        options = Options()
        options.parseOptions(['--pop3s', '8995',
                              '--certificate', cert.path])
        self.assertEqual(len(options['pop3']), 2)
        self.assertIsInstance(
            options['pop3'][0], endpoints.SSL4ServerEndpoint)
        self.assertIsInstance(
            options['pop3'][1], endpoints.TCP4ServerEndpoint)

        warnings = self.flushWarnings([options.postOptions])
        self.assertEqual(len(warnings), 1)
        self.assertEqual(warnings[0]['category'], DeprecationWarning)
        self.assertEqual(
            warnings[0]['message'],
            "Specifying plain ports and/or a certificate is deprecated since "
            "Twisted 11.0; use endpoint descriptions instead.")
開發者ID:12019,項目名稱:OpenWrt_Luci_Lua,代碼行數:22,代碼來源:test_options.py


注:本文中的twisted.mail.tap.Options類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。