From 88d21d210c15d76000b6a3c69e47a55b1582d054 Mon Sep 17 00:00:00 2001 From: Lance Stout Date: Wed, 6 Oct 2010 18:46:23 -0400 Subject: [PATCH] Corrected stream header tester. Added test for testing stream headers. --- tests/sleektest.py | 6 +++--- tests/test_streamtester.py | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/tests/sleektest.py b/tests/sleektest.py index e795189..e08a8de 100644 --- a/tests/sleektest.py +++ b/tests/sleektest.py @@ -378,7 +378,6 @@ class SleekTest(unittest.TestCase): self.xmpp.socket.recvData(header) self.xmpp.connect = lambda a=None, b=None, c=None, d=None: True - self.xmpp.start_tls = lambda: True self.xmpp.process(threaded=True) if skip: # Clear startup stanzas @@ -420,6 +419,7 @@ class SleekTest(unittest.TestCase): appended before the stream header. """ header = '' + parts = [] if xml_header: header = '' + header if sto: @@ -467,8 +467,8 @@ class SleekTest(unittest.TestCase): # Apply closing elements so that we can construct # XML objects for comparison. - header2 += '' - sent_header2 += '' + header2 = header + '' + sent_header2 = sent_header + '' xml = ET.fromstring(header2) sent_xml = ET.fromstring(sent_header2) diff --git a/tests/test_streamtester.py b/tests/test_streamtester.py index 8512f40..8a4f82d 100644 --- a/tests/test_streamtester.py +++ b/tests/test_streamtester.py @@ -16,15 +16,15 @@ class TestStreamTester(SleekTest): def echo(msg): msg.reply('Thanks for sending: %(body)s' % msg).send() - + self.xmpp.add_event_handler('message', echo) - + self.streamRecv(""" Hi! """) - + self.streamSendMessage(""" Thanks for sending: Hi! @@ -52,4 +52,9 @@ class TestStreamTester(SleekTest): """) + def testSendStreamHeader(self): + """Test that we can check a sent stream header.""" + self.streamStart(mode='client', skip=False) + self.streamSendHeader(sto='localhost') + suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamTester)