本文整理汇总了Python中twisted.mail.tap.Options.parseOptions方法的典型用法代码示例。如果您正苦于以下问题:Python Options.parseOptions方法的具体用法?Python Options.parseOptions怎么用?Python Options.parseOptions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.mail.tap.Options
的用法示例。
在下文中一共展示了Options.parseOptions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _endpointTest
# 需要导入模块: from twisted.mail.tap import Options [as 别名]
# 或者: from twisted.mail.tap.Options import parseOptions [as 别名]
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)
示例2: test_auth
# 需要导入模块: from twisted.mail.tap import Options [as 别名]
# 或者: from twisted.mail.tap.Options import parseOptions [as 别名]
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])
示例3: test_protoDisable
# 需要导入模块: from twisted.mail.tap import Options [as 别名]
# 或者: from twisted.mail.tap.Options import parseOptions [as 别名]
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'), [])
示例4: test_protoDefaults
# 需要导入模块: from twisted.mail.tap import Options [as 别名]
# 或者: from twisted.mail.tap.Options import parseOptions [as 别名]
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)
示例5: test_barePort
# 需要导入模块: from twisted.mail.tap import Options [as 别名]
# 或者: from twisted.mail.tap.Options import parseOptions [as 别名]
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.")
示例6: test_pop3sBackwardCompatibility
# 需要导入模块: from twisted.mail.tap import Options [as 别名]
# 或者: from twisted.mail.tap.Options import parseOptions [as 别名]
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.")