Ignore:
Timestamp:
Oct 17, 2008, 10:47:01 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@111
Message:

we now have basic support with nick change, also added some doc strings, still need more re #24

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_muc.py

    r116 r117  
    5858
    5959    def _createRoom(self):
     60        """A helper method to create a test room.
     61        """
    6062        # create a room
    6163        self.current_room = muc.Room(self.test_room, self.test_srv, self.test_nick)
     
    7173
    7274    def test_userJoinedRoom(self):
    73         """Test receiving a user joined event.
     75        """The client receives presence from an entity joining the room.
    7476        """
    7577        p = muc.UserPresence()
     
    9193
    9294    def test_groupChat(self):
    93         """Test receiving room presence
     95        """The client receives a groupchat message from an entity in the room.
    9496        """
    9597        m = muc.GroupChat('test@test.com',body='test')
     
    109111
    110112    def test_discoServerSupport(self):
    111         """Test for disco support from a server.
     113        """Disco support from client to server.
    112114        """
    113115        test_srv = 'shakespeare.lit'
     
    138140       
    139141    def test_joinRoom(self):
    140         """Test joining a room
    141         """
    142        
    143 
     142        """Joining a room
     143        """
     144       
    144145        def cb(room):
    145146            self.assertEquals(self.test_room, room.name)
     
    159160
    160161    def test_joinRoomForbidden(self):
    161         """Test joining a room and getting an error
     162        """Client joining a room and getting a forbidden error.
    162163        """
    163164
     
    183184
    184185    def test_partRoom(self):
    185        
     186        """Client leaves a room
     187        """
    186188        def cb(left):
    187189            self.failUnless(left, 'did not leave room')
     
    204206
    205207    def test_ban(self):
    206        
     208        """Ban an entity in a room.
     209        """
    207210        banned = JID('ban@jabber.org/TroubleMakger')
    208211        def cb(banned):
     
    225228
    226229    def test_kick(self):
    227 
     230        """Kick an entity from a room.
     231        """
    228232        kicked = JID('kick@jabber.org/TroubleMakger')
    229233        def cb(kicked):
     
    247251
    248252    def test_password(self):
    249         """Test sending a password via presence to a password protected room.
     253        """Sending a password via presence to a password protected room.
    250254        """
    251255       
     
    258262
    259263    def test_history(self):
    260         """Test receiving history on room join.
     264        """Receiving history on room join.
    261265        """
    262266        m = muc.HistoryMessage(self.room_jid.userhost(), self.protocol._makeTimeStamp(), body='test')
     
    276280
    277281    def test_oneToOneChat(self):
    278         """Test converting a one to one chat
     282        """Converting a one to one chat to a multi-user chat.
    279283        """
    280284        archive = []
     
    308312
    309313    def test_invite(self):
     314        """Invite a user to a room
     315        """
    310316        other_jid = 'test@jabber.org'
    311317
     
    319325       
    320326    def test_privateMessage(self):
    321         """Test sending private messages to muc entities.
     327        """Send private messages to muc entities.
    322328        """
    323329        other_nick = self.room_jid.userhost()+'/OtherNick'
     
    331337
    332338    def test_register(self):
    333         """Test client registering with a room. http://xmpp.org/extensions/xep-0045.html#register
     339        """Client registering with a room. http://xmpp.org/extensions/xep-0045.html#register
    334340
    335341        """
     
    343349
    344350        iq = self.stub.output[-1]
    345         print iq.toXml()
    346351        self.failUnless(xpath.matches("/iq/query[@xmlns='%s']" % (muc.NS_REQUEST), iq), 'Invalid iq register request')
    347352       
     
    352357
    353358    def test_voice(self):
    354         """
     359        """ Client requesting voice for a room.
    355360        """
    356361        self.protocol.voice(self.room_jid.userhost())
     
    362367
    363368    def test_roomConfigure(self):
    364         """
     369        """ Default configure and changing the room name.
    365370        """
    366371
     
    386391
    387392
     393    def test_nickChange(self):
     394        """Send a nick change to the server.
     395        """
     396        test_nick = 'newNick'
     397       
     398        self._createRoom()
     399
     400        def cb(room):
     401            self.assertEquals(self.test_room, room.name)
     402            self.assertEquals(test_nick, room.nick)
     403
     404        d = self.protocol.nick(self.room_jid, test_nick)
     405        d.addCallback(cb)
     406
     407        prs = self.stub.output[-1]
     408        self.failUnless(prs.name=='presence', "Need to be presence")
     409        self.failUnless(getattr(prs, 'x', None), 'No muc x element')
     410
     411        # send back user presence, they joined       
     412        response = muc.UserPresence(frm=self.test_room+'@'+self.test_srv+'/'+test_nick)
     413       
     414        self.stub.send(response)
     415        return d
     416
     417       
Note: See TracChangeset for help on using the changeset viewer.