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

Add test for room history limit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_muc.py

    r145 r146  
    203203
    204204
     205    def test_joinHistory(self):
     206        """
     207        Passing a history parameter sends a 'maxstanzas' history limit.
     208        """
     209
     210        def cb(room):
     211            self.assertEquals(self.roomIdentifier, room.roomIdentifier)
     212
     213        d = self.protocol.join(self.service, self.roomIdentifier, self.nick,
     214                               history=10)
     215        d.addCallback(cb)
     216
     217        element = self.stub.output[-1]
     218        query = "/*/x[@xmlns='%s']/history[@xmlns='%s']" % (muc.NS_MUC,
     219                                                            muc.NS_MUC)
     220        result = xpath.queryForNodes(query, element)
     221        history = result[0]
     222        self.assertEquals('10', history.getAttribute('maxstanzas'))
     223
     224        # send back user presence, they joined
     225        xml = """
     226            <presence from='%s@%s/%s'>
     227              <x xmlns='http://jabber.org/protocol/muc#user'>
     228                <item affiliation='member' role='participant'/>
     229              </x>
     230            </presence>
     231        """ % (self.roomIdentifier, self.service, self.nick)
     232        self.stub.send(parseXml(xml))
     233        return d
     234
     235
    205236    def test_joinForbidden(self):
    206237        """
Note: See TracChangeset for help on using the changeset viewer.