Changeset 87:c9d1bf0b783d


Ignore:
Timestamp:
Jan 10, 2010, 3:01:41 PM (11 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Correctly report disco identity for PubSubService? without PubSubResource?.

Author: ralphm.
Fixes #64.

Location:
wokkel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wokkel/pubsub.py

    r86 r87  
    10481048        self.resource = resource
    10491049        self.discoIdentity = {'category': 'pubsub',
    1050                               'type': 'generic',
     1050                              'type': 'service',
    10511051                              'name': 'Generic Publish-Subscribe Service'}
    10521052
     
    10931093            getInfo = resource.getInfo
    10941094        else:
    1095             category, idType, name = self.discoIdentity
     1095            category = self.discoIdentity['category']
     1096            idType = self.discoIdentity['type']
     1097            name = self.discoIdentity['name']
    10961098            identity = disco.DiscoIdentity(category, idType, name)
    10971099            features = self.pubSubFeatures
     
    11041106                         for feature in features])
    11051107
    1106         d = getInfo(requestor, target, nodeIdentifier or '')
     1108        d = defer.maybeDeferred(getInfo, requestor, target, nodeIdentifier or '')
    11071109        d.addCallback(toInfo, info)
    11081110        d.addErrback(log.err)
  • wokkel/test/test_pubsub.py

    r86 r87  
    31573157
    31583158
     3159    def test_getDiscoInfo(self):
     3160        """
     3161        Test getDiscoInfo calls getNodeInfo and returns some minimal info.
     3162        """
     3163        def cb(info):
     3164            discoInfo = disco.DiscoInfo()
     3165            for item in info:
     3166                discoInfo.append(item)
     3167            self.assertIn(('pubsub', 'service'), discoInfo.identities)
     3168            self.assertIn(disco.NS_DISCO_ITEMS, discoInfo.features)
     3169
     3170        d = self.service.getDiscoInfo(JID('user@example.org/home'),
     3171                                      JID('pubsub.example.org'), '')
     3172        d.addCallback(cb)
     3173        return d
     3174
     3175
    31593176    def test_publish(self):
    31603177        """
Note: See TracChangeset for help on using the changeset viewer.