1 https://bugs.gentoo.org/show_bug.cgi?id=351468
2 http://twistedmatrix.com/trac/ticket/4771
3 http://twistedmatrix.com/trac/changeset/30430
5 --- twisted/words/protocols/jabber/jstrports.py
6 +++ twisted/words/protocols/jabber/jstrports.py
8 # -*- test-case-name: twisted.words.test -*-
9 -# Copyright (c) 2001-2005 Twisted Matrix Laboratories.
10 +# Copyright (c) 2001-2011 Twisted Matrix Laboratories.
11 # See LICENSE for details.
14 """ A temporary placeholder for client-capable strports, until we
15 sufficient use cases get identified """
17 -from twisted.application import strports
18 +from twisted.internet.endpoints import _parse
20 def _parseTCPSSL(factory, domain, port):
21 """ For the moment, parse TCP or SSL connections the same """
25 def parse(description, factory):
26 - args, kw = strports._parse(description)
27 + args, kw = _parse(description)
28 return (args[0].upper(),) + _funcs[args[0]](factory, *args[1:], **kw)
30 def client(description, factory):
31 --- twisted/words/test/test_jabberjstrports.py
32 +++ twisted/words/test/test_jabberjstrports.py
34 +# Copyright (c) 2011 Twisted Matrix Laboratories.
35 +# See LICENSE for details.
38 +Tests for L{twisted.words.protocols.jabber.jstrports}.
41 +from twisted.trial import unittest
43 +from twisted.words.protocols.jabber import jstrports
44 +from twisted.application.internet import TCPClient
47 +class JabberStrPortsPlaceHolderTest(unittest.TestCase):
49 + Tests for L{jstrports}
52 + def test_parse(self):
54 + L{jstrports.parse} accepts an endpoint description string and returns a
55 + tuple and dict of parsed endpoint arguments.
57 + expected = ('TCP', ('DOMAIN', 65535, 'Factory'), {})
58 + got = jstrports.parse("tcp:DOMAIN:65535", "Factory")
59 + self.assertEquals(expected, got)
62 + def test_client(self):
64 + L{jstrports.client} returns a L{TCPClient} service.
66 + got = jstrports.client("tcp:DOMAIN:65535", "Factory")
67 + self.assertIsInstance(got, TCPClient)