summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2010-10-07 09:22:27 -0400
committerLance Stout <lancestout@gmail.com>2010-10-07 09:22:27 -0400
commit75a051556f2cf65f75534102a7fe57a52571494a (patch)
tree7b0205c55b16bde132eb9d7443bb9c56f1dde5da
parent78141fe5f3d3e8267b6969690b93dd7aba41cf65 (diff)
downloadslixmpp-75a051556f2cf65f75534102a7fe57a52571494a.tar.gz
slixmpp-75a051556f2cf65f75534102a7fe57a52571494a.tar.bz2
slixmpp-75a051556f2cf65f75534102a7fe57a52571494a.tar.xz
slixmpp-75a051556f2cf65f75534102a7fe57a52571494a.zip
Changed SleekTest to use underscored names.
-rw-r--r--tests/sleektest.py176
-rw-r--r--tests/test_addresses.py18
-rw-r--r--tests/test_chatstates.py10
-rw-r--r--tests/test_disco.py14
-rw-r--r--tests/test_elementbase.py36
-rw-r--r--tests/test_errorstanzas.py8
-rw-r--r--tests/test_events.py4
-rw-r--r--tests/test_forms.py8
-rw-r--r--tests/test_gmail.py2
-rw-r--r--tests/test_handlers.py20
-rw-r--r--tests/test_iqstanzas.py20
-rw-r--r--tests/test_messagestanzas.py4
-rw-r--r--tests/test_presencestanzas.py10
-rw-r--r--tests/test_pubsubstanzas.py38
-rw-r--r--tests/test_roster.py4
-rw-r--r--tests/test_streamtester.py16
16 files changed, 209 insertions, 179 deletions
diff --git a/tests/sleektest.py b/tests/sleektest.py
index e08a8deb..28901877 100644
--- a/tests/sleektest.py
+++ b/tests/sleektest.py
@@ -27,12 +27,12 @@ class TestSocket(object):
of an actual networking socket.
Methods:
- nextSent -- Return the next sent stanza.
- recvData -- Make a stanza available to read next.
- recv -- Read the next stanza from the socket.
- send -- Write a stanza to the socket.
- makefile -- Dummy call, returns self.
- read -- Read the next stanza from the socket.
+ next_sent -- Return the next sent stanza.
+ recv_data -- Make a stanza available to read next.
+ recv -- Read the next stanza from the socket.
+ send -- Write a stanza to the socket.
+ makefile -- Dummy call, returns self.
+ read -- Read the next stanza from the socket.
"""
def __init__(self, *args, **kwargs):
@@ -70,7 +70,7 @@ class TestSocket(object):
# ------------------------------------------------------------------
# Testing Interface
- def nextSent(self, timeout=None):
+ def next_sent(self, timeout=None):
"""
Get the next stanza that has been 'sent'.
@@ -85,7 +85,7 @@ class TestSocket(object):
except:
return None
- def recvData(self, data):
+ def recv_data(self, data):
"""
Add data to the receiving queue.
@@ -153,23 +153,28 @@ class SleekTest(unittest.TestCase):
methods for comparing message, iq, and presence stanzas.
Methods:
- Message -- Create a Message stanza object.
- Iq -- Create an Iq stanza object.
- Presence -- Create a Presence stanza object.
- checkMessage -- Compare a Message stanza against an XML string.
- checkIq -- Compare an Iq stanza against an XML string.
- checkPresence -- Compare a Presence stanza against an XML string.
- streamStart -- Initialize a dummy XMPP client.
- streamRecv -- Queue data for XMPP client to receive.
- streamSendMessage -- Check that the XMPP client sent the given
- Message stanza.
- streamSendIq -- Check that the XMPP client sent the given
- Iq stanza.
- streamSendPresence -- Check taht the XMPP client sent the given
- Presence stanza.
- streamClose -- Disconnect the XMPP client.
- fix_namespaces -- Add top-level namespace to an XML object.
- compare -- Compare XML objects against each other.
+ Message -- Create a Message stanza object.
+ Iq -- Create an Iq stanza object.
+ Presence -- Create a Presence stanza object.
+ check_stanza -- Compare a generic stanza against an XML string.
+ check_message -- Compare a Message stanza against an XML string.
+ check_iq -- Compare an Iq stanza against an XML string.
+ check_presence -- Compare a Presence stanza against an XML string.
+ stream_start -- Initialize a dummy XMPP client.
+ stream_recv -- Queue data for XMPP client to receive.
+ stream_make_header -- Create a stream header.
+ stream_send_header -- Check that the given header has been sent.
+ stream_send_message -- Check that the XMPP client sent the given
+ Message stanza.
+ stream_send_iq -- Check that the XMPP client sent the given
+ Iq stanza.
+ stream_send_presence -- Check thatt the XMPP client sent the given
+ Presence stanza.
+ stream_send_stanza -- Check that the XMPP client sent the given
+ generic stanza.
+ stream_close -- Disconnect the XMPP client.
+ fix_namespaces -- Add top-level namespace to an XML object.
+ compare -- Compare XML objects against each other.
"""
# ------------------------------------------------------------------
@@ -211,8 +216,8 @@ class SleekTest(unittest.TestCase):
# ------------------------------------------------------------------
# Methods for comparing stanza objects to XML strings
- def checkStanza(self, stanza_class, stanza, xml_string,
- defaults=None, use_values=True):
+ def check_stanza(self, stanza_class, stanza, xml_string,
+ defaults=None, use_values=True):
"""
Create and compare several stanza objects to a correct XML string.
@@ -289,7 +294,7 @@ class SleekTest(unittest.TestCase):
self.failUnless(result, debug)
- def checkMessage(self, msg, xml_string, use_values=True):
+ def check_message(self, msg, xml_string, use_values=True):
"""
Create and compare several message stanza objects to a
correct XML string.
@@ -305,11 +310,11 @@ class SleekTest(unittest.TestCase):
to True.
"""
- return self.checkStanza(Message, msg, xml_string,
+ return self.check_stanza(Message, msg, xml_string,
defaults=['type'],
use_values=use_values)
- def checkIq(self, iq, xml_string, use_values=True):
+ def check_iq(self, iq, xml_string, use_values=True):
"""
Create and compare several iq stanza objects to a
correct XML string.
@@ -324,9 +329,9 @@ class SleekTest(unittest.TestCase):
and setStanzaValues should be used. Defaults
to True.
"""
- return self.checkStanza(Iq, iq, xml_string, use_values=use_values)
+ return self.check_stanza(Iq, iq, xml_string, use_values=use_values)
- def checkPresence(self, pres, xml_string, use_values=True):
+ def check_presence(self, pres, xml_string, use_values=True):
"""
Create and compare several presence stanza objects to a
correct XML string.
@@ -341,14 +346,14 @@ class SleekTest(unittest.TestCase):
and setStanzaValues should be used. Defaults
to True.
"""
- return self.checkStanza(Presence, pres, xml_string,
+ return self.check_stanza(Presence, pres, xml_string,
defaults=['priority'],
use_values=use_values)
# ------------------------------------------------------------------
# Methods for simulating stanza streams.
- def streamStart(self, mode='client', skip=True, header=None):
+ def stream_start(self, mode='client', skip=True, header=None):
"""
Initialize an XMPP client or component using a dummy XML stream.
@@ -375,17 +380,17 @@ class SleekTest(unittest.TestCase):
# Must have the stream header ready for xmpp.process() to work.
if not header:
header = self.xmpp.stream_header
- self.xmpp.socket.recvData(header)
+ self.xmpp.socket.recv_data(header)
self.xmpp.connect = lambda a=None, b=None, c=None, d=None: True
self.xmpp.process(threaded=True)
if skip:
# Clear startup stanzas
- self.xmpp.socket.nextSent(timeout=0.01)
+ self.xmpp.socket.next_sent(timeout=0.01)
if mode == 'component':
- self.xmpp.socket.nextSent(timeout=0.01)
+ self.xmpp.socket.next_sent(timeout=0.01)
- def streamRecv(self, data):
+ def stream_recv(self, data):
"""
Pass data to the dummy XMPP client as if it came from an XMPP server.
@@ -394,9 +399,9 @@ class SleekTest(unittest.TestCase):
XMPP client or component.
"""
data = str(data)
- self.xmpp.socket.recvData(data)
+ self.xmpp.socket.recv_data(data)
- def makeStreamHeader(self, sto='',
+ def stream_make_header(self, sto='',
sfrom='',
sid='',
stream_ns="http://etherx.jabber.org/streams",
@@ -406,7 +411,7 @@ class SleekTest(unittest.TestCase):
"""
Create a stream header to be received by the test XMPP agent.
- The header must be saved and passed to streamStart.
+ The header must be saved and passed to stream_start.
Arguments:
sto -- The recipient of the stream header.
@@ -433,14 +438,14 @@ class SleekTest(unittest.TestCase):
parts.append('xmlns="%s"' % default_ns)
return header % ' '.join(parts)
- def streamSendHeader(self, sto='',
- sfrom='',
- sid='',
- stream_ns="http://etherx.jabber.org/streams",
- default_ns="jabber:client",
- version="1.0",
- xml_header=False,
- timeout=0.1):
+ def stream_send_header(self, sto='',
+ sfrom='',
+ sid='',
+ stream_ns="http://etherx.jabber.org/streams",
+ default_ns="jabber:client",
+ version="1.0",
+ xml_header=False,
+ timeout=0.1):
"""
Check that a given stream header was sent.
@@ -456,12 +461,12 @@ class SleekTest(unittest.TestCase):
timeout -- Length of time to wait in seconds for a
response.
"""
- header = self.makeStreamHeader(sto, sfrom, sid,
- stream_ns=stream_ns,
- default_ns=default_ns,
- version=version,
- xml_header=xml_header)
- sent_header = self.xmpp.socket.nextSent(timeout)
+ header = self.stream_make_header(sto, sfrom, sid,
+ stream_ns=stream_ns,
+ default_ns=default_ns,
+ version=version,
+ xml_header=xml_header)
+ sent_header = self.xmpp.socket.next_sent(timeout)
if sent_header is None:
raise ValueError("Socket did not return data.")
@@ -478,75 +483,100 @@ class SleekTest(unittest.TestCase):
"Stream headers do not match:\nDesired:\n%s\nSent:\n%s" % (
header, sent_header))
- def streamSendMessage(self, data, use_values=True, timeout=.1):
+ def stream_send_stanza(self, stanza_class, data, defaults=None,
+ use_values=True, timeout=.1):
+ """
+ Check that the XMPP client sent the given stanza XML.
+
+ Extracts the next sent stanza and compares it with the given
+ XML using check_stanza.
+
+ Arguments:
+ stanza_class -- The class of the sent stanza object.
+ data -- The XML string of the expected Message stanza,
+ or an equivalent stanza object.
+ use_values -- Modifies the type of tests used by check_message.
+ defaults -- A list of stanza interfaces that have defaults
+ values which may interfere with comparisons.
+ timeout -- Time in seconds to wait for a stanza before
+ failing the check.
+ """
+ if isintance(data, str):
+ data = stanza_class(xml=ET.fromstring(data))
+ sent = self.xmpp.socket.next_sent(timeout)
+ self.check_stanza(stanza_class, data, sent,
+ defaults=defaults,
+ use_values=use_values)
+
+ def stream_send_message(self, data, use_values=True, timeout=.1):
"""
Check that the XMPP client sent the given stanza XML.
Extracts the next sent stanza and compares it with the given
- XML using checkMessage.
+ XML using check_message.
Arguments:
data -- The XML string of the expected Message stanza,
or an equivalent stanza object.
- use_values -- Modifies the type of tests used by checkMessage.
+ use_values -- Modifies the type of tests used by check_message.
timeout -- Time in seconds to wait for a stanza before
failing the check.
"""
if isinstance(data, str):
data = self.Message(xml=ET.fromstring(data))
- sent = self.xmpp.socket.nextSent(timeout)
- self.checkMessage(data, sent, use_values)
+ sent = self.xmpp.socket.next_sent(timeout)
+ self.check_message(data, sent, use_values)
- def streamSendIq(self, data, use_values=True, timeout=.1):
+ def stream_send_iq(self, data, use_values=True, timeout=.1):
"""
Check that the XMPP client sent the given stanza XML.
Extracts the next sent stanza and compares it with the given
- XML using checkIq.
+ XML using check_iq.
Arguments:
data -- The XML string of the expected Iq stanza,
or an equivalent stanza object.
- use_values -- Modifies the type of tests used by checkIq.
+ use_values -- Modifies the type of tests used by check_iq.
timeout -- Time in seconds to wait for a stanza before
failing the check.
"""
if isinstance(data, str):
data = self.Iq(xml=ET.fromstring(data))
- sent = self.xmpp.socket.nextSent(timeout)
- self.checkIq(data, sent, use_values)
+ sent = self.xmpp.socket.next_sent(timeout)
+ self.check_iq(data, sent, use_values)
- def streamSendPresence(self, data, use_values=True, timeout=.1):
+ def stream_send_presence(self, data, use_values=True, timeout=.1):
"""
Check that the XMPP client sent the given stanza XML.
Extracts the next sent stanza and compares it with the given
- XML using checkPresence.
+ XML using check_presence.
Arguments:
data -- The XML string of the expected Presence stanza,
or an equivalent stanza object.
- use_values -- Modifies the type of tests used by checkPresence.
+ use_values -- Modifies the type of tests used by check_presence.
timeout -- Time in seconds to wait for a stanza before
failing the check.
"""
if isinstance(data, str):
data = self.Presence(xml=ET.fromstring(data))
- sent = self.xmpp.socket.nextSent(timeout)
- self.checkPresence(data, sent, use_values)
+ sent = self.xmpp.socket.next_sent(timeout)
+ self.check_presence(data, sent, use_values)
- def streamClose(self):
+ def stream_close(self):
"""
Disconnect the dummy XMPP client.
- Can be safely called even if streamStart has not been called.
+ Can be safely called even if stream_start has not been called.
Must be placed in the tearDown method of a test class to ensure
that the XMPP client is disconnected after an error.
"""
if hasattr(self, 'xmpp') and self.xmpp is not None:
self.xmpp.disconnect()
- self.xmpp.socket.recvData(self.xmpp.stream_footer)
+ self.xmpp.socket.recv_data(self.xmpp.stream_footer)
# ------------------------------------------------------------------
# XML Comparison and Cleanup
diff --git a/tests/test_addresses.py b/tests/test_addresses.py
index 450e1362..5c510c78 100644
--- a/tests/test_addresses.py
+++ b/tests/test_addresses.py
@@ -11,7 +11,7 @@ class TestAddresses(SleekTest):
"""Testing adding extended stanza address."""
msg = self.Message()
msg['addresses'].addAddress(atype='to', jid='to@header1.org')
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message>
<addresses xmlns="http://jabber.org/protocol/address">
<address jid="to@header1.org" type="to" />
@@ -23,7 +23,7 @@ class TestAddresses(SleekTest):
msg['addresses'].addAddress(atype='replyto',
jid='replyto@header1.org',
desc='Reply address')
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message>
<addresses xmlns="http://jabber.org/protocol/address">
<address jid="replyto@header1.org" type="replyto" desc="Reply address" />
@@ -53,14 +53,14 @@ class TestAddresses(SleekTest):
'jid':'cc@header2.org'},
{'type':'bcc',
'jid':'bcc@header2.org'}])
- self.checkMessage(msg, xmlstring)
+ self.check_message(msg, xmlstring)
msg = self.Message()
msg['addresses']['replyto'] = [{'jid':'replyto@header1.org',
'desc':'Reply address'}]
msg['addresses']['cc'] = [{'jid':'cc@header2.org'}]
msg['addresses']['bcc'] = [{'jid':'bcc@header2.org'}]
- self.checkMessage(msg, xmlstring)
+ self.check_message(msg, xmlstring)
def testAddURI(self):
"""Testing adding URI attribute to extended stanza address."""
@@ -69,7 +69,7 @@ class TestAddresses(SleekTest):
addr = msg['addresses'].addAddress(atype='to',
jid='to@header1.org',
node='foo')
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message>
<addresses xmlns="http://jabber.org/protocol/address">
<address node="foo" jid="to@header1.org" type="to" />
@@ -78,7 +78,7 @@ class TestAddresses(SleekTest):
""")
addr['uri'] = 'mailto:to@header2.org'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message>
<addresses xmlns="http://jabber.org/protocol/address">
<address type="to" uri="mailto:to@header2.org" />
@@ -99,13 +99,13 @@ class TestAddresses(SleekTest):
msg = self.Message()
addr = msg['addresses'].addAddress(jid='to@header1.org', atype='to')
- self.checkMessage(msg, xmlstring % '')
+ self.check_message(msg, xmlstring % '')
addr['delivered'] = True
- self.checkMessage(msg, xmlstring % 'delivered="true"')
+ self.check_message(msg, xmlstring % 'delivered="true"')
addr['delivered'] = False
- self.checkMessage(msg, xmlstring % '')
+ self.check_message(msg, xmlstring % '')
suite = unittest.TestLoader().loadTestsFromTestCase(TestAddresses)
diff --git a/tests/test_chatstates.py b/tests/test_chatstates.py
index 74359df9..d5e3979a 100644
--- a/tests/test_chatstates.py
+++ b/tests/test_chatstates.py
@@ -21,24 +21,24 @@ class TestChatStates(SleekTest):
msg = self.Message()
msg['chat_state'].active()
- self.checkMessage(msg, xmlstring % 'active',
+ self.check_message(msg, xmlstring % 'active',
use_values=False)
msg['chat_state'].composing()
- self.checkMessage(msg, xmlstring % 'composing',
+ self.check_message(msg, xmlstring % 'composing',
use_values=False)
msg['chat_state'].gone()
- self.checkMessage(msg, xmlstring % 'gone',
+ self.check_message(msg, xmlstring % 'gone',
use_values=False)
msg['chat_state'].inactive()
- self.checkMessage(msg, xmlstring % 'inactive',
+ self.check_message(msg, xmlstring % 'inactive',
use_values=False)
msg['chat_state'].paused()
- self.checkMessage(msg, xmlstring % 'paused',
+ self.check_message(msg, xmlstring % 'paused',
use_values=False)
suite = unittest.TestLoader().loadTestsFromTestCase(TestChatStates)
diff --git a/tests/test_disco.py b/tests/test_disco.py
index 2cc50ee0..f65fdaf4 100644
--- a/tests/test_disco.py
+++ b/tests/test_disco.py
@@ -14,7 +14,7 @@ class TestDisco(SleekTest):
iq['id'] = "0"
iq['disco_info']['node'] = ''
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<query xmlns="http://jabber.org/protocol/disco#info" />
</iq>
@@ -26,7 +26,7 @@ class TestDisco(SleekTest):
iq['id'] = "0"
iq['disco_info']['node'] = 'foo'
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<query xmlns="http://jabber.org/protocol/disco#info" node="foo" />
</iq>
@@ -38,7 +38,7 @@ class TestDisco(SleekTest):
iq['id'] = "0"
iq['disco_items']['node'] = ''
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<query xmlns="http://jabber.org/protocol/disco#items" />
</iq>
@@ -50,7 +50,7 @@ class TestDisco(SleekTest):
iq['id'] = "0"
iq['disco_items']['node'] = 'foo'
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<query xmlns="http://jabber.org/protocol/disco#items" node="foo" />
</iq>
@@ -63,7 +63,7 @@ class TestDisco(SleekTest):
iq['disco_info']['node'] = 'foo'
iq['disco_info'].addIdentity('conference', 'text', 'Chatroom')
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<query xmlns="http://jabber.org/protocol/disco#info" node="foo">
<identity category="conference" type="text" name="Chatroom" />
@@ -79,7 +79,7 @@ class TestDisco(SleekTest):
iq['disco_info'].addFeature('foo')
iq['disco_info'].addFeature('bar')
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<query xmlns="http://jabber.org/protocol/disco#info" node="foo">
<feature var="foo" />
@@ -97,7 +97,7 @@ class TestDisco(SleekTest):
iq['disco_items'].addItem('user@localhost', 'foo')
iq['disco_items'].addItem('user@localhost', 'bar', 'Testing')
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<query xmlns="http://jabber.org/protocol/disco#items" node="foo">
<item jid="user@localhost" />
diff --git a/tests/test_elementbase.py b/tests/test_elementbase.py
index dfd37b53..19794c90 100644
--- a/tests/test_elementbase.py
+++ b/tests/test_elementbase.py
@@ -26,7 +26,7 @@ class TestElementBase(SleekTest):
namespace = "test"
stanza = TestStanza()
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="test">
<bar>
<baz />
@@ -116,7 +116,7 @@ class TestElementBase(SleekTest):
'baz': ''}]}
stanza.setStanzaValues(values)
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo" bar="a">
<pluginfoo baz="b" />
<pluginfoo2 bar="d" baz="e" />
@@ -197,7 +197,7 @@ class TestElementBase(SleekTest):
stanza['qux'] = 'overridden'
stanza['foobar'] = 'plugin'
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo" bar="attribute!">
<baz>element!</baz>
<foobar foobar="plugin" />
@@ -230,7 +230,7 @@ class TestElementBase(SleekTest):
stanza['qux'] = 'c'
stanza['foobar']['foobar'] = 'd'
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo" baz="b" qux="c">
<bar>a</bar>
<foobar foobar="d" />
@@ -242,7 +242,7 @@ class TestElementBase(SleekTest):
del stanza['qux']
del stanza['foobar']
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo" qux="c" />
""")
@@ -256,7 +256,7 @@ class TestElementBase(SleekTest):
stanza = TestStanza()
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo" />
""")
@@ -266,7 +266,7 @@ class TestElementBase(SleekTest):
stanza._setAttr('bar', 'a')
stanza._setAttr('baz', 'b')
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo" bar="a" baz="b" />
""")
@@ -276,7 +276,7 @@ class TestElementBase(SleekTest):
stanza._setAttr('bar', None)
stanza._delAttr('baz')
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo" />
""")
@@ -306,7 +306,7 @@ class TestElementBase(SleekTest):
"Default _getSubText value incorrect.")
stanza['bar'] = 'found'
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<wrapper>
<bar>found</bar>
@@ -339,7 +339,7 @@ class TestElementBase(SleekTest):
stanza = TestStanza()
stanza['bar'] = 'a'
stanza['baz'] = 'b'
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<wrapper>
<bar>a</bar>
@@ -348,7 +348,7 @@ class TestElementBase(SleekTest):
</foo>
""")
stanza._setSubText('wrapper/bar', text='', keep=True)
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<wrapper>
<bar />
@@ -359,7 +359,7 @@ class TestElementBase(SleekTest):
stanza['bar'] = 'a'
stanza._setSubText('wrapper/bar', text='')
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<wrapper>
<baz>b</baz>
@@ -397,7 +397,7 @@ class TestElementBase(SleekTest):
stanza['bar'] = 'a'
stanza['baz'] = 'b'
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<path>
<to>
@@ -415,7 +415,7 @@ class TestElementBase(SleekTest):
del stanza['bar']
del stanza['baz']
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<path>
<to>
@@ -431,7 +431,7 @@ class TestElementBase(SleekTest):
stanza._delSub('path/to/only/bar', all=True)
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<path>
<to>
@@ -602,7 +602,7 @@ class TestElementBase(SleekTest):
"Incorrect empty stanza size.")
stanza.append(substanza1)
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<foobar qux="a" />
</foo>
@@ -611,7 +611,7 @@ class TestElementBase(SleekTest):
"Incorrect stanza size with 1 substanza.")
stanza.append(substanza2)
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<foobar qux="a" />
<foobar qux="b" />
@@ -622,7 +622,7 @@ class TestElementBase(SleekTest):
# Test popping substanzas
stanza.pop(0)
- self.checkStanza(TestStanza, stanza, """
+ self.check_stanza(TestStanza, stanza, """
<foo xmlns="foo">
<foobar qux="b" />
</foo>
diff --git a/tests/test_errorstanzas.py b/tests/test_errorstanzas.py
index d6fafc59..a883b7ef 100644
--- a/tests/test_errorstanzas.py
+++ b/tests/test_errorstanzas.py
@@ -6,7 +6,7 @@ class TestErrorStanzas(SleekTest):
"""Test setting initial values in error stanza."""
msg = self.Message()
msg.enable('error')
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="error">
<error type="cancel">
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
@@ -19,7 +19,7 @@ class TestErrorStanzas(SleekTest):
msg = self.Message()
msg['error']['condition'] = 'item-not-found'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="error">
<error type="cancel">
<item-not-found xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
@@ -31,7 +31,7 @@ class TestErrorStanzas(SleekTest):
del msg['error']['condition']
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="error">
<error type="cancel" />
</message>
@@ -45,7 +45,7 @@ class TestErrorStanzas(SleekTest):
del msg['error']['condition']
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="error">
<error type="cancel">
<text xmlns="urn:ietf:params:xml:ns:xmpp-stanzas">Error!</text>
diff --git a/tests/test_events.py b/tests/test_events.py
index df36969d..d9d80c30 100644
--- a/tests/test_events.py
+++ b/tests/test_events.py
@@ -6,10 +6,10 @@ from . sleektest import *
class TestEvents(SleekTest):
def setUp(self):
- self.streamStart()
+ self.stream_start()
def tearDown(self):
- self.streamClose()
+ self.stream_close()
def testEventHappening(self):
"""Test handler working"""
diff --git a/tests/test_forms.py b/tests/test_forms.py
index d5710633..67b0f6a8 100644
--- a/tests/test_forms.py
+++ b/tests/test_forms.py
@@ -14,7 +14,7 @@ class TestDataForms(SleekTest):
msg = self.Message()
msg['form']['instructions'] = "Instructions\nSecond batch"
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message>
<x xmlns="jabber:x:data" type="form">
<instructions>Instructions</instructions>
@@ -35,7 +35,7 @@ class TestDataForms(SleekTest):
required=True,
value='Some text!')
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message>
<x xmlns="jabber:x:data" type="form">
<field var="f1" type="text-single" label="Text">
@@ -62,7 +62,7 @@ class TestDataForms(SleekTest):
'value': 'cool'},
{'label': 'Urgh!',
'value': 'urgh'}]})]
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message>
<x xmlns="jabber:x:data" type="form">
<field var="f1" type="text-single" label="Username">
@@ -99,7 +99,7 @@ class TestDataForms(SleekTest):
form.setValues({'foo': 'Foo!',
'bar': ['a', 'b']})
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message>
<x xmlns="jabber:x:data" type="form">
<field var="foo" type="text-single">
diff --git a/tests/test_gmail.py b/tests/test_gmail.py
index dd256e27..5636e877 100644
--- a/tests/test_gmail.py
+++ b/tests/test_gmail.py
@@ -18,7 +18,7 @@ class TestGmail(SleekTest):
iq['gmail']['newer-than-time'] = '1140638252542'
iq['gmail']['newer-than-tid'] = '11134623426430234'
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq type="get">
<query xmlns="google:mail:notify"
newer-than-time="1140638252542"
diff --git a/tests/test_handlers.py b/tests/test_handlers.py
index 3e931930..70eb0248 100644
--- a/tests/test_handlers.py
+++ b/tests/test_handlers.py
@@ -9,10 +9,10 @@ class TestHandlers(SleekTest):
"""
def setUp(self):
- self.streamStart()
+ self.stream_start()
def tearDown(self):
- self.streamClose()
+ self.stream_close()
def testCallback(self):
"""Test using stream callback handlers."""
@@ -30,11 +30,11 @@ class TestHandlers(SleekTest):
self.xmpp.registerHandler(callback)
- self.streamRecv("""<tester xmlns="test" />""")
+ self.stream_recv("""<tester xmlns="test" />""")
msg = self.Message()
msg['body'] = 'Success!'
- self.streamSendMessage(msg)
+ self.stream_send_message(msg)
def testWaiter(self):
"""Test using stream waiter handler."""
@@ -55,7 +55,7 @@ class TestHandlers(SleekTest):
self.xmpp.add_event_handler('message', waiter_handler, threaded=True)
# Send message to trigger waiter_handler
- self.streamRecv("""
+ self.stream_recv("""
<message>
<body>Testing</body>
</message>
@@ -66,10 +66,10 @@ class TestHandlers(SleekTest):
iq['id'] = 'test'
iq['type'] = 'set'
iq['query'] = 'test'
- self.streamSendIq(iq)
+ self.stream_send_iq(iq)
# Send the reply Iq
- self.streamRecv("""
+ self.stream_recv("""
<iq id="test" type="result">
<query xmlns="test" />
</iq>
@@ -78,7 +78,7 @@ class TestHandlers(SleekTest):
# Check that waiter_handler received the reply
msg = self.Message()
msg['body'] = 'Successful: test'
- self.streamSendMessage(msg)
+ self.stream_send_message(msg)
def testWaiterTimeout(self):
"""Test that waiter handler is removed after timeout."""
@@ -93,14 +93,14 @@ class TestHandlers(SleekTest):
self.xmpp.add_event_handler('message', waiter_handler, threaded=True)
# Start test by triggerig waiter_handler
- self.streamRecv("""<message><body>Start Test</body></message>""")
+ self.stream_recv("""<message><body>Start Test</body></message>""")
# Check that Iq was sent to trigger start of timeout period
iq = self.Iq()
iq['id'] = 'test2'
iq['type'] = 'set'
iq['query'] = 'test2'
- self.streamSendIq(iq)
+ self.stream_send_iq(iq)
# Check that the waiter is no longer registered
waiter_exists = self.xmpp.removeHandler('IqWait_test2')
diff --git a/tests/test_iqstanzas.py b/tests/test_iqstanzas.py
index 2dabc5e9..197bc001 100644
--- a/tests/test_iqstanzas.py
+++ b/tests/test_iqstanzas.py
@@ -6,12 +6,12 @@ class TestIqStanzas(SleekTest):
def tearDown(self):
"""Shutdown the XML stream after testing."""
- self.streamClose()
+ self.stream_close()
def testSetup(self):
"""Test initializing default Iq values."""
iq = self.Iq()
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0" />
""")
@@ -19,7 +19,7 @@ class TestIqStanzas(SleekTest):
"""Test setting Iq stanza payload."""
iq = self.Iq()
iq.setPayload(ET.Element('{test}tester'))
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<tester xmlns="test" />
</iq>
@@ -28,8 +28,8 @@ class TestIqStanzas(SleekTest):
def testUnhandled(self):
"""Test behavior for Iq.unhandled."""
- self.streamStart()
- self.streamRecv("""
+ self.stream_start()
+ self.stream_recv("""
<iq id="test" type="get">
<query xmlns="test" />
</iq>
@@ -40,7 +40,7 @@ class TestIqStanzas(SleekTest):
iq['error']['condition'] = 'feature-not-implemented'
iq['error']['text'] = 'No handlers registered for this request.'
- self.streamSendIq(iq, """
+ self.stream_send_iq(iq, """
<iq id="test" type="error">
<error type="cancel">
<feature-not-implemented xmlns="urn:ietf:params:xml:ns:xmpp-stanzas" />
@@ -56,14 +56,14 @@ class TestIqStanzas(SleekTest):
iq = self.Iq()
iq['query'] = 'query_ns'
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<query xmlns="query_ns" />
</iq>
""")
iq['query'] = 'query_ns2'
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<query xmlns="query_ns2" />
</iq>
@@ -72,7 +72,7 @@ class TestIqStanzas(SleekTest):
self.failUnless(iq['query'] == 'query_ns2', "Query namespace doesn't match")
del iq['query']
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0" />
""")
@@ -83,7 +83,7 @@ class TestIqStanzas(SleekTest):
iq['type'] = 'get'
iq.reply()
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0" type="result" />
""")
diff --git a/tests/test_messagestanzas.py b/tests/test_messagestanzas.py
index 2a1567da..d57f5ad4 100644
--- a/tests/test_messagestanzas.py
+++ b/tests/test_messagestanzas.py
@@ -33,7 +33,7 @@ class TestMessageStanzas(SleekTest):
p = ET.Element('{http://www.w3.org/1999/xhtml}p')
p.text = "This is the htmlim message"
msg['html']['body'] = p
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message to="fritzy@netflint.net/sleekxmpp" type="chat">
<body>this is the plaintext message</body>
<html xmlns="http://jabber.org/protocol/xhtml-im">
@@ -47,7 +47,7 @@ class TestMessageStanzas(SleekTest):
"Test message/nick/nick stanza."
msg = self.Message()
msg['nick']['nick'] = 'A nickname!'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message>
<nick xmlns="http://jabber.org/nick/nick">A nickname!</nick>
</message>
diff --git a/tests/test_presencestanzas.py b/tests/test_presencestanzas.py
index f4a33aa7..2452df4f 100644
--- a/tests/test_presencestanzas.py
+++ b/tests/test_presencestanzas.py
@@ -9,26 +9,26 @@ class TestPresenceStanzas(SleekTest):
"""Regression check presence['type'] = 'dnd' show value working"""
p = self.Presence()
p['type'] = 'dnd'
- self.checkPresence(p, "<presence><show>dnd</show></presence>")
+ self.check_presence(p, "<presence><show>dnd</show></presence>")
def testPresenceType(self):
"""Test manipulating presence['type']"""
p = self.Presence()
p['type'] = 'available'
- self.checkPresence(p, "<presence />")
+ self.check_presence(p, "<presence />")
self.failUnless(p['type'] == 'available',
"Incorrect presence['type'] for type 'available'")
for showtype in ['away', 'chat', 'dnd', 'xa']:
p['type'] = showtype
- self.checkPresence(p, """
+ self.check_presence(p, """
<presence><show>%s</show></presence>
""" % showtype)
self.failUnless(p['type'] == showtype,
"Incorrect presence['type'] for type '%s'" % showtype)
p['type'] = None
- self.checkPresence(p, "<presence />")
+ self.check_presence(p, "<presence />")
def testPresenceUnsolicitedOffline(self):
"""
@@ -57,7 +57,7 @@ class TestPresenceStanzas(SleekTest):
"""Test presence/nick/nick stanza."""
p = self.Presence()
p['nick']['nick'] = 'A nickname!'
- self.checkPresence(p, """
+ self.check_presence(p, """
<presence>
<nick xmlns="http://jabber.org/nick/nick">A nickname!</nick>
</presence>
diff --git a/tests/test_pubsubstanzas.py b/tests/test_pubsubstanzas.py
index 38fc29e5..42a1b52e 100644
--- a/tests/test_pubsubstanzas.py
+++ b/tests/test_pubsubstanzas.py
@@ -16,7 +16,7 @@ class TestPubsubStanzas(SleekTest):
aff2['affiliation'] = 'publisher'
iq['pubsub']['affiliations'].append(aff1)
iq['pubsub']['affiliations'].append(aff2)
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<affiliations>
@@ -38,7 +38,7 @@ class TestPubsubStanzas(SleekTest):
sub2['subscription'] = 'subscribed'
iq['pubsub']['subscriptions'].append(sub1)
iq['pubsub']['subscriptions'].append(sub2)
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<subscriptions>
@@ -55,7 +55,7 @@ class TestPubsubStanzas(SleekTest):
iq['pubsub']['subscription']['node'] = 'testnode alsdkjfas'
iq['pubsub']['subscription']['jid'] = "fritzy@netflint.net/sleekxmpp"
iq['pubsub']['subscription']['subscription'] = 'unconfigured'
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<subscription node="testnode alsdkjfas" jid="fritzy@netflint.net/sleekxmpp" subscription="unconfigured">
@@ -88,7 +88,7 @@ class TestPubsubStanzas(SleekTest):
item2['payload'] = payload2
iq['pubsub']['items'].append(item)
iq['pubsub']['items'].append(item2)
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<items node="crap">
@@ -115,7 +115,7 @@ class TestPubsubStanzas(SleekTest):
iq['pubsub']['configure']['form'].addField('pubsub#title',
ftype='text-single',
value='This thing is awesome')
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<create node="mynode" />
@@ -136,7 +136,7 @@ class TestPubsubStanzas(SleekTest):
iq['psstate']['item']= 'myitem'
pl = ET.Element('{http://andyet.net/protocol/pubsubqueue}claimed')
iq['psstate']['payload'] = pl
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<state xmlns="http://jabber.org/protocol/psstate" node="mynode" item="myitem">
<claimed xmlns="http://andyet.net/protocol/pubsubqueue" />
@@ -152,7 +152,7 @@ class TestPubsubStanzas(SleekTest):
iq['pubsub_owner']['default']['form'].addField('pubsub#title',
ftype='text-single',
value='This thing is awesome')
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
<default node="mynode" type="leaf">
@@ -176,7 +176,7 @@ class TestPubsubStanzas(SleekTest):
form = xep_0004.Form()
form.addField('pubsub#title', ftype='text-single', value='this thing is awesome')
iq['pubsub']['subscribe']['options']['options'] = form
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<subscribe node="cheese" jid="fritzy@netflint.net/sleekxmpp">
@@ -214,7 +214,7 @@ class TestPubsubStanzas(SleekTest):
iq['pubsub']['publish'].append(item)
iq['pubsub']['publish'].append(item2)
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<publish node="thingers">
@@ -238,7 +238,7 @@ class TestPubsubStanzas(SleekTest):
"Testing iq/pubsub_owner/delete stanzas"
iq = self.Iq()
iq['pubsub_owner']['delete']['node'] = 'thingers'
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq id="0">
<pubsub xmlns="http://jabber.org/protocol/pubsub#owner">
<delete node="thingers" />
@@ -300,7 +300,7 @@ class TestPubsubStanzas(SleekTest):
'label': 'Deliver notification only to available users'}),
])
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq to="pubsub.asdf" type="set" id="E" from="fritzy@asdf/87292ede-524d-4117-9076-d934ed3db8e7">
<pubsub xmlns="http://jabber.org/protocol/pubsub">
<create node="testnode2" />
@@ -357,7 +357,7 @@ class TestPubsubStanzas(SleekTest):
msg['pubsub_event']['items'].append(item)
msg['pubsub_event']['items']['node'] = 'cheese'
msg['type'] = 'normal'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="normal">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="cheese">
@@ -383,7 +383,7 @@ class TestPubsubStanzas(SleekTest):
msg['pubsub_event']['items'].append(item2)
msg['pubsub_event']['items']['node'] = 'cheese'
msg['type'] = 'normal'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="normal">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="cheese">
@@ -415,7 +415,7 @@ class TestPubsubStanzas(SleekTest):
msg['pubsub_event']['items'].append(item2)
msg['pubsub_event']['items']['node'] = 'cheese'
msg['type'] = 'normal'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="normal">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<items node="cheese">
@@ -435,7 +435,7 @@ class TestPubsubStanzas(SleekTest):
msg['pubsub_event']['collection']['associate']['node'] = 'cheese'
msg['pubsub_event']['collection']['node'] = 'cheeseburger'
msg['type'] = 'headline'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="headline">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<collection node="cheeseburger">
@@ -450,7 +450,7 @@ class TestPubsubStanzas(SleekTest):
msg['pubsub_event']['collection']['disassociate']['node'] = 'cheese'
msg['pubsub_event']['collection']['node'] = 'cheeseburger'
msg['type'] = 'headline'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="headline">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<collection node="cheeseburger">
@@ -467,7 +467,7 @@ class TestPubsubStanzas(SleekTest):
ftype='text-single',
value='This thing is awesome')
msg['type'] = 'headline'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="headline">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<configuration node="cheese">
@@ -485,7 +485,7 @@ class TestPubsubStanzas(SleekTest):
msg = self.Message()
msg['pubsub_event']['purge']['node'] = 'pickles'
msg['type'] = 'headline'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="headline">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<purge node="pickles" />
@@ -501,7 +501,7 @@ class TestPubsubStanzas(SleekTest):
msg['pubsub_event']['subscription']['subscription'] = 'subscribed'
msg['pubsub_event']['subscription']['expiry'] = 'presence'
msg['type'] = 'headline'
- self.checkMessage(msg, """
+ self.check_message(msg, """
<message type="headline">
<event xmlns="http://jabber.org/protocol/pubsub#event">
<subscription node="pickles" subid="aabb1122" jid="fritzy@netflint.net/test" subscription="subscribed" expiry="presence" />
diff --git a/tests/test_roster.py b/tests/test_roster.py
index 6f9fa3d6..f210551d 100644
--- a/tests/test_roster.py
+++ b/tests/test_roster.py
@@ -16,7 +16,7 @@ class TestRosterStanzas(SleekTest):
'name': 'Other User',
'subscription': 'both',
'groups': []}})
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq>
<query xmlns="jabber:iq:roster">
<item jid="user@example.com" name="User" subscription="both">
@@ -74,7 +74,7 @@ class TestRosterStanzas(SleekTest):
"""
iq = self.Iq(ET.fromstring(xml_string))
del iq['roster']['items']
- self.checkIq(iq, """
+ self.check_iq(iq, """
<iq>
<query xmlns="jabber:iq:roster" />
</iq>
diff --git a/tests/test_streamtester.py b/tests/test_streamtester.py
index 8a4f82dd..9bc9de67 100644
--- a/tests/test_streamtester.py
+++ b/tests/test_streamtester.py
@@ -8,24 +8,24 @@ class TestStreamTester(SleekTest):
"""
def tearDown(self):
- self.streamClose()
+ self.stream_close()
def testClientEcho(self):
"""Test that we can interact with a ClientXMPP instance."""
- self.streamStart(mode='client')
+ self.stream_start(mode='client')
def echo(msg):
msg.reply('Thanks for sending: %(body)s' % msg).send()
self.xmpp.add_event_handler('message', echo)
- self.streamRecv("""
+ self.stream_recv("""
<message to="tester@localhost" from="user@localhost">
<body>Hi!</body>
</message>
""")
- self.streamSendMessage("""
+ self.stream_send_message("""
<message to="user@localhost">
<body>Thanks for sending: Hi!</body>
</message>
@@ -33,20 +33,20 @@ class TestStreamTester(SleekTest):
def testComponentEcho(self):
"""Test that we can interact with a ComponentXMPP instance."""
- self.streamStart(mode='component')
+ self.stream_start(mode='component')
def echo(msg):
msg.reply('Thanks for sending: %(body)s' % msg).send()
self.xmpp.add_event_handler('message', echo)
- self.streamRecv("""
+ self.stream_recv("""
<message to="tester.localhost" from="user@localhost">
<body>Hi!</body>
</message>
""")
- self.streamSendMessage("""
+ self.stream_send_message("""
<message to="user@localhost" from="tester.localhost">
<body>Thanks for sending: Hi!</body>
</message>
@@ -54,7 +54,7 @@ class TestStreamTester(SleekTest):
def testSendStreamHeader(self):
"""Test that we can check a sent stream header."""
- self.streamStart(mode='client', skip=False)
+ self.stream_start(mode='client', skip=False)
self.streamSendHeader(sto='localhost')
suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamTester)