summaryrefslogtreecommitdiff
path: root/tests/test_presencestanzas.py
diff options
context:
space:
mode:
authorNathan Fritz <nathan@andyet.net>2010-05-12 18:07:20 -0700
committerNathan Fritz <nathan@andyet.net>2010-05-12 18:07:20 -0700
commitae41c08fecfe627627f2a4d9b3861d4ae24d673e (patch)
tree318eb2d25fb8c8211c157e35912584be2852c633 /tests/test_presencestanzas.py
parent223507f36f6dd4c0d4a0733a524fd529231b010b (diff)
downloadslixmpp-ae41c08fecfe627627f2a4d9b3861d4ae24d673e.tar.gz
slixmpp-ae41c08fecfe627627f2a4d9b3861d4ae24d673e.tar.bz2
slixmpp-ae41c08fecfe627627f2a4d9b3861d4ae24d673e.tar.xz
slixmpp-ae41c08fecfe627627f2a4d9b3861d4ae24d673e.zip
added test for unsolicided unavailable presence and fixed bug to make it pass
Diffstat (limited to 'tests/test_presencestanzas.py')
-rw-r--r--tests/test_presencestanzas.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_presencestanzas.py b/tests/test_presencestanzas.py
index 430c71ca..23eb911e 100644
--- a/tests/test_presencestanzas.py
+++ b/tests/test_presencestanzas.py
@@ -11,5 +11,21 @@ class testpresencestanzas(unittest.TestCase):
p = self.p.Presence()
p['type'] = 'dnd'
self.failUnless(str(p) == "<presence><show>dnd</show></presence>")
+
+ def testPresenceUnsolicitedOffline(self):
+ "Unsolicted offline presence does not spawn changed_status or update roster"
+ p = self.p.Presence()
+ p['type'] = 'unavailable'
+ p['from'] = 'bill@chadmore.com/gmail15af'
+ import sleekxmpp
+ c = sleekxmpp.ClientXMPP('crap@wherever', 'password')
+ happened = []
+ def handlechangedpresence(event):
+ happened.append(True)
+ c.add_event_handler("changed_status", handlechangedpresence)
+ c._handlePresence(p)
+ self.failUnless(happened == [], "changed_status event triggered for superfulous unavailable presence")
+ self.failUnless(c.roster == {}, "Roster updated for superfulous unavailable presence")
+
suite = unittest.TestLoader().loadTestsFromTestCase(testpresencestanzas)