Ignore:
Timestamp:
Jul 8, 2009, 10:05:58 PM (13 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@183
Message:

Add support for the XMPP Ping protocol.

Author: ralphm
Fixes #55.

This adds a whole bunch of examples around the ping protocol in different
settings for both the pinger and pingee: as a external server-side component,
as a standalone server with server-to-server connectivity and as a client.

Also updates the disco support to allow for non-deferred responses from
subprotocol handlers

Location:
wokkel/test
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_disco.py

    r63 r65  
    752752
    753753
     754    def test_infoNotDeferred(self):
     755        """
     756        C{info} should gather disco info from sibling handlers.
     757        """
     758        discoItems = [disco.DiscoIdentity('dummy', 'generic',
     759                                          'Generic Dummy Entity'),
     760                      disco.DiscoFeature('jabber:iq:version')
     761        ]
     762
     763        class DiscoResponder(XMPPHandler):
     764            implements(disco.IDisco)
     765
     766            def getDiscoInfo(self, requestor, target, nodeIdentifier):
     767                if not nodeIdentifier:
     768                    return discoItems
     769                else:
     770                    return []
     771
     772        def cb(result):
     773            self.assertEquals(discoItems, result)
     774
     775        self.service.parent = [self.service, DiscoResponder()]
     776        d = self.service.info(JID('test@example.com'), JID('example.com'), '')
     777        d.addCallback(cb)
     778        return d
     779
     780
    754781    def test_items(self):
    755782        """
     
    774801        d.addCallback(cb)
    775802        return d
     803
     804
     805    def test_itemsNotDeferred(self):
     806        """
     807        C{info} should also collect results not returned via a deferred.
     808        """
     809        discoItems = [disco.DiscoItem(JID('example.com'), 'test', 'Test node')]
     810
     811        class DiscoResponder(XMPPHandler):
     812            implements(disco.IDisco)
     813
     814            def getDiscoItems(self, requestor, target, nodeIdentifier):
     815                if not nodeIdentifier:
     816                    return discoItems
     817                else:
     818                    return []
     819
     820        def cb(result):
     821            self.assertEquals(discoItems, result)
     822
     823        self.service.parent = [self.service, DiscoResponder()]
     824        d = self.service.items(JID('test@example.com'), JID('example.com'), '')
     825        d.addCallback(cb)
     826        return d
Note: See TracChangeset for help on using the changeset viewer.