Fix several errors in SleekTest.
Notably, not sending an expected stanza will not silently pass.
This commit is contained in:
parent
19bd1e0485
commit
defc252c7d
1 changed files with 11 additions and 9 deletions
|
@ -77,6 +77,8 @@ class SleekTest(unittest.TestCase):
|
|||
xml = self.parse_xml(xml_string)
|
||||
xml = xml.getchildren()[0]
|
||||
return xml
|
||||
else:
|
||||
self.fail("XML data was mal-formed:\n%s" % xml_string)
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Shortcut methods for creating stanza objects
|
||||
|
@ -399,7 +401,7 @@ class SleekTest(unittest.TestCase):
|
|||
# receiving data.
|
||||
recv_data = self.xmpp.socket.next_recv(timeout)
|
||||
if recv_data is None:
|
||||
return False
|
||||
self.fail("No stanza was received.")
|
||||
xml = self.parse_xml(recv_data)
|
||||
self.fix_namespaces(xml, 'jabber:client')
|
||||
stanza = self.xmpp._build_stanza(xml, 'jabber:client')
|
||||
|
@ -494,7 +496,7 @@ class SleekTest(unittest.TestCase):
|
|||
xml = self.parse_xml(data)
|
||||
recv_xml = self.parse_xml(recv_data)
|
||||
if recv_data is None:
|
||||
return False
|
||||
self.fail("No stanza was received.")
|
||||
if method == 'exact':
|
||||
self.failUnless(self.compare(xml, recv_xml),
|
||||
"Features do not match.\nDesired:\n%s\nReceived:\n%s" % (
|
||||
|
@ -564,7 +566,7 @@ class SleekTest(unittest.TestCase):
|
|||
xml = self.parse_xml(data)
|
||||
sent_xml = self.parse_xml(sent_data)
|
||||
if sent_data is None:
|
||||
return False
|
||||
self.fail("No stanza was sent.")
|
||||
if method == 'exact':
|
||||
self.failUnless(self.compare(xml, sent_xml),
|
||||
"Features do not match.\nDesired:\n%s\nReceived:\n%s" % (
|
||||
|
@ -602,7 +604,7 @@ class SleekTest(unittest.TestCase):
|
|||
"""
|
||||
sent = self.xmpp.socket.next_sent(timeout)
|
||||
if sent is None:
|
||||
return False
|
||||
self.fail("No stanza was sent.")
|
||||
xml = self.parse_xml(sent)
|
||||
self.fix_namespaces(xml, 'jabber:client')
|
||||
sent = self.xmpp._build_stanza(xml, 'jabber:client')
|
||||
|
|
Loading…
Reference in a new issue