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