2f70d8e94cf089b3173bffd72ba12e4103712899
[gentoo.git] /
1 https://bugs.gentoo.org/show_bug.cgi?id=351468
2 http://twistedmatrix.com/trac/ticket/4771
3 http://twistedmatrix.com/trac/changeset/30430
4
5 --- twisted/words/protocols/jabber/jstrports.py
6 +++ twisted/words/protocols/jabber/jstrports.py
7 @@ -1,12 +1,12 @@
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.
12  
13  
14  """ A temporary placeholder for client-capable strports, until we
15  sufficient use cases get identified """
16  
17 -from twisted.application import strports
18 +from twisted.internet.endpoints import _parse
19  
20  def _parseTCPSSL(factory, domain, port):
21      """ For the moment, parse TCP or SSL connections the same """
22 @@ -22,7 +22,7 @@
23  
24  
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)
29  
30  def client(description, factory):
31 --- twisted/words/test/test_jabberjstrports.py
32 +++ twisted/words/test/test_jabberjstrports.py
33 @@ -0,0 +1,34 @@
34 +# Copyright (c) 2011 Twisted Matrix Laboratories.
35 +# See LICENSE for details.
36 +
37 +"""
38 +Tests for L{twisted.words.protocols.jabber.jstrports}.
39 +"""
40 +
41 +from twisted.trial import unittest
42 +
43 +from twisted.words.protocols.jabber import jstrports
44 +from twisted.application.internet import TCPClient
45 +
46 +
47 +class JabberStrPortsPlaceHolderTest(unittest.TestCase):
48 +    """
49 +    Tests for L{jstrports}
50 +    """
51 +
52 +    def test_parse(self):
53 +        """
54 +        L{jstrports.parse} accepts an endpoint description string and returns a
55 +        tuple and dict of parsed endpoint arguments.
56 +        """
57 +        expected = ('TCP', ('DOMAIN', 65535, 'Factory'), {})
58 +        got = jstrports.parse("tcp:DOMAIN:65535", "Factory")
59 +        self.assertEquals(expected, got)
60 +
61 +
62 +    def test_client(self):
63 +        """
64 +        L{jstrports.client} returns a L{TCPClient} service.
65 +        """
66 +        got = jstrports.client("tcp:DOMAIN:65535", "Factory")
67 +        self.assertIsInstance(got, TCPClient)