Ignore:
Timestamp:
Aug 12, 2011, 2:11:43 PM (9 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
wokkel-muc-client-support-24
Message:

Use generic.Request for room destruction request, add TestableStreamManager?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_muc.py

    r146 r147  
    2020from wokkel import data_form, iwokkel, muc
    2121from wokkel.generic import parseXml
    22 from wokkel.test.helpers import XmlStreamStub
     22from wokkel.test.helpers import XmlStreamStub, TestableStreamManager
    2323
    2424
     
    4747
    4848    def setUp(self):
    49         self.stub = XmlStreamStub()
    5049        self.clock = task.Clock()
     50        self.sessionManager = TestableStreamManager(reactor=self.clock)
     51        self.stub = self.sessionManager.stub
    5152        self.protocol = muc.MUCClient(reactor=self.clock)
    52         self.protocol.xmlstream = self.stub.xmlstream
    53         self.protocol.connectionInitialized()
     53        self.protocol.setHandlerParent(self.sessionManager)
     54
    5455        self.roomIdentifier = 'test'
    5556        self.service  = 'conference.example.org'
     
    620621        Destroy a room.
    621622        """
    622 
    623         def cb(destroyed):
    624             self.assertTrue(destroyed, 'Room not destroyed.')
    625 
    626         d = self.protocol.destroy(self.occupantJID)
    627         d.addCallback(cb)
     623        d = self.protocol.destroy(self.occupantJID, reason='Time to leave',
     624                                  alternate=JID('other@%s' % self.service),
     625                                  password='secret')
    628626
    629627        iq = self.stub.output[-1]
    630         query = "/iq/query[@xmlns='%s']/destroy"% muc.NS_MUC_OWNER
    631         self.assertTrue(xpath.matches(query, iq), 'Bad configure request')
     628
     629        query = ("/iq/query[@xmlns='%s']/destroy[@xmlns='%s']" %
     630                 (muc.NS_MUC_OWNER, muc.NS_MUC_OWNER))
     631
     632        nodes = xpath.queryForNodes(query, iq)
     633        self.assertNotIdentical(None, nodes, 'Bad configure request')
     634        destroy = nodes[0]
     635        self.assertEquals('Time to leave', unicode(destroy.reason))
    632636
    633637        response = toResponse(iq, 'result')
Note: See TracChangeset for help on using the changeset viewer.