mirror of
https://github.com/correl/SleekXMPP.git
synced 2024-11-27 11:09:56 +00:00
Updated SleekTest to implement the checkPresence method.
Also, removed unnecessary TestStream class and shortened timeout during stream connection.
This commit is contained in:
parent
278a8bb443
commit
14f1c3ba51
1 changed files with 29 additions and 8 deletions
|
@ -77,12 +77,6 @@ class TestSocket(object):
|
|||
except:
|
||||
return None
|
||||
|
||||
class TestStream(object):
|
||||
"""Dummy class to pass a stream object to created stanzas"""
|
||||
|
||||
def __init__(self):
|
||||
self.default_ns = 'jabber:client'
|
||||
|
||||
|
||||
class SleekTest(unittest.TestCase):
|
||||
"""
|
||||
|
@ -186,7 +180,34 @@ class SleekTest(unittest.TestCase):
|
|||
If use_values is False, the test using getValues() and
|
||||
setValues() will not be used.
|
||||
"""
|
||||
pass
|
||||
self.fix_namespaces(pres.xml, 'jabber:client')
|
||||
debug = "Given Stanza:\n%s\n" % ET.tostring(pres.xml)
|
||||
|
||||
xml = ET.fromstring(xml_string)
|
||||
self.fix_namespaces(xml, 'jabber:client')
|
||||
debug += "XML String:\n%s\n" % ET.tostring(xml)
|
||||
|
||||
pres2 = self.Presence(xml)
|
||||
debug += "Constructed Stanza:\n%s\n" % ET.tostring(pres2.xml)
|
||||
|
||||
# Ugly, but 'priority' has a default value and need to make
|
||||
# sure it is set
|
||||
pres['priority'] = pres['priority']
|
||||
pres2['priority'] = pres2['priority']
|
||||
|
||||
if use_values:
|
||||
values = pres.getStanzaValues()
|
||||
pres3 = self.Presence()
|
||||
pres3.setStanzaValues(values)
|
||||
|
||||
debug += "Second Constructed Stanza:\n%s\n" % ET.tostring(pres3.xml)
|
||||
debug = "Three methods for creating stanza do not match:\n" + debug
|
||||
self.failUnless(self.compare([xml, pres.xml, pres2.xml, pres3.xml]),
|
||||
debug)
|
||||
else:
|
||||
debug = "Two methods for creating stanza do not match:\n" + debug
|
||||
self.failUnless(self.compare([xml, pres.xml, pres2.xml]), debug)
|
||||
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Methods for simulating stanza streams.
|
||||
|
@ -208,7 +229,7 @@ class SleekTest(unittest.TestCase):
|
|||
self.xmpp.process(threaded=True)
|
||||
if skip:
|
||||
# Clear startup stanzas
|
||||
self.xmpp.socket.nextSent(timeout=1)
|
||||
self.xmpp.socket.nextSent(timeout=0.1)
|
||||
|
||||
def streamRecv(self, data):
|
||||
data = str(data)
|
||||
|
|
Loading…
Reference in a new issue