blob: 6d8f045d3567e0de034a856078caa33a109c411b (
plain)
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
|
# Copyright (c) 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.assertEqual(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)
|