Ignore:
Timestamp:
Oct 3, 2008, 8:50:37 PM (14 years ago)
Author:
Christopher Zorn <tofu@…>
Branch:
wokkel-muc-client-support-24
Convert:
svn:b33ecbfc-034c-dc11-8662-000475d9059e/branches/wokkel-muc-client-support-24@72
Message:

add leave room, register for a room and other things for re #24, still need admin and owner stuff, more tests and more docs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_muc.py

    r110 r111  
    227227       
    228228    def test_privateMessage(self):
     229       
    229230        self.fail('Not Implemented')
    230231
    231232    def test_register(self):
    232         self.fail('Not Implemented')
     233        """Test client registering with a room. http://xmpp.org/extensions/xep-0045.html#register
     234
     235        """
     236       
     237        def cb(iq):
     238            # check for a result
     239            self.failUnless(iq['type']=='result', 'We did not get a result')
     240       
     241        d = self.protocol.register(self.room_jid.userhost())
     242        d.addCallback(cb)
     243
     244        iq = self.stub.output[-1]
     245       
     246        self.failUnless(xpath.matches("/iq/query[@xmlns='%s']" % (muc.NS_REQUEST), iq), 'Invalid iq register request')
     247       
     248        response = toResponse(iq, 'result')
     249        self.stub.send(response)
     250        return d
    233251
    234252    def test_voice(self):
    235        
     253        """
     254        """
    236255        self.protocol.voice(self.room_jid.userhost())
    237256
    238257        m = self.stub.output[-1]
    239         self.failUnless(m.name=='message', "Need to be message stanza")
    240         self.failUnless(getattr(m, 'x', None), 'No muc x element')
    241 
     258       
    242259        self.failUnless(xpath.matches("/message/x[@type='submit']/field/value[text()='%s']" % (muc.NS_REQUEST,), m), 'Invalid voice message stanza')
    243260
    244261
    245262    def test_roomConfigure(self):
    246 
    247         self.fail('Not Implemented')
    248        
    249 
     263        """
     264        """
     265
     266        def cb(iq):
     267            self.failUnless(iq['type']=='result', 'Not a result')
     268           
     269
     270        fields = []
     271
     272        fields.append(data_form.Field(label='Natural-Language Room Name',
     273                                      var='muc#roomconfig_roomname',
     274                                      value=self.test_room))
     275       
     276        d = self.protocol.configure(self.room_jid.userhost(), fields)
     277        d.addCallback(cb)
     278
     279        iq = self.stub.output[-1]
     280        self.failUnless(xpath.matches("/iq/query[@xmlns='%s']/x"% (muc.NS_OWNER,), iq), 'Bad configure request')
     281       
     282        response = toResponse(iq, 'result')
     283        self.stub.send(response)
     284        return d
     285
     286
Note: See TracChangeset for help on using the changeset viewer.