• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python tap.Options类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python client.createResolver函数代码示例发布时间:2022-05-27
下一篇:
Python smtp.sendmail函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap