Ignore:
Timestamp:
Oct 4, 2007, 9:47:22 AM (14 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@13
Message:

Support services on a JID.

Author: ralphm
Fixes #2.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_disco.py

    r1 r6  
    77
    88from twisted.internet import defer
    9 from twisted.test import proto_helpers
    109from twisted.trial import unittest
    1110from twisted.words.xish.xmlstream import XmlStreamFactory
     
    2221    implements(disco.IDisco)
    2322
    24     def getDiscoInfo(self, nodeIdentifier):
     23    def getDiscoInfo(self, requestor, target, nodeIdentifier):
    2524        if nodeIdentifier is None:
    2625            return defer.succeed([
    27                 disco.Identity('dummy', 'generic', 'Generic Dummy Entity'),
    28                 disco.Feature('jabber:iq:version')
     26                disco.DiscoIdentity('dummy', 'generic', 'Generic Dummy Entity'),
     27                disco.DiscoFeature('jabber:iq:version')
    2928            ])
    3029        else:
     
    3534        factory = XmlStreamFactory()
    3635        sm = StreamManager(factory)
    37         sm.addHandler(disco.DiscoHandler())
    38         sm.addHandler(DiscoResponder())
     36        disco.DiscoHandler().setHandlerParent(sm)
     37        DiscoResponder().setHandlerParent(sm)
    3938        xs = factory.buildProtocol(None)
    40         xs.transport = proto_helpers.StringTransport()
     39        output = []
     40        xs.send = output.append
    4141        xs.connectionMade()
     42        xs.dispatch(xs, "//event/stream/authd")
    4243        xs.dataReceived("<stream>")
    43         xs.dataReceived("""<iq from='test@example.com' type='get'>
     44        xs.dataReceived("""<iq from='test@example.com' to='example.com'
     45                               type='get'>
    4446                             <query xmlns='%s'/>
    4547                           </iq>""" % NS_DISCO_INFO)
     48        reply = output[0]
     49        self.assertEqual(NS_DISCO_INFO, reply.query.uri)
     50        self.assertEqual(NS_DISCO_INFO, reply.query.identity.uri)
     51        self.assertEqual('dummy', reply.query.identity['category'])
     52        self.assertEqual('generic', reply.query.identity['type'])
     53        self.assertEqual('Generic Dummy Entity', reply.query.identity['name'])
     54        self.assertEqual(NS_DISCO_INFO, reply.query.feature.uri)
     55        self.assertEqual('jabber:iq:version', reply.query.feature['var'])
     56
Note: See TracChangeset for help on using the changeset viewer.