Changeset 125:edb21c02197b for wokkel/test/test_muc.py
- Timestamp:
- Oct 21, 2008, 12:32:00 AM (14 years ago)
- Branch:
- wokkel-muc-client-support-24
- Convert:
- svn:b33ecbfc-034c-dc11-8662-000475d9059e/branches/wokkel-muc-client-support-24@121
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wokkel/test/test_muc.py
r120 r125 74 74 def test_userJoinedRoom(self): 75 75 """The client receives presence from an entity joining the room. 76 77 This tests the class L{muc.UserPresence} and the userJoinedRoom event method. 78 79 The test sends the user presence and tests if the event method is called. 80 76 81 """ 77 82 p = muc.UserPresence() … … 184 189 self.stub.send(response) 185 190 return d 191 192 193 def test_joinRoomBadJid(self): 194 """Client joining a room and getting a forbidden error. 195 """ 196 197 def cb(error): 198 199 self.failUnless(error.value.mucCondition=='jid-malformed','Wrong muc condition') 200 201 202 203 d = self.protocol.join(self.test_srv, self.test_room, self.test_nick) 204 d.addBoth(cb) 205 206 prs = self.stub.output[-1] 207 self.failUnless(prs.name=='presence', "Need to be presence") 208 self.failUnless(getattr(prs, 'x', None), 'No muc x element') 209 # send back user presence, they joined 210 211 response = muc.PresenceError(error=muc.MUCError('modify', 212 'jid-malformed' 213 ), 214 frm=self.room_jid.full()) 215 self.stub.send(response) 216 return d 217 218 186 219 187 220 def test_partRoom(self): … … 442 475 return d 443 476 444 477 def test_grantVoice(self): 478 """Test granting voice to a user. 479 480 """ 481 give_voice = JID('ban@jabber.org/TroubleMakger') 482 def cb(give_voice): 483 self.failUnless(give_voice, 'Did not give voice user') 484 485 486 d = self.protocol.grantVoice(self.user_jid, self.room_jid, give_voice) 487 d.addCallback(cb) 488 489 iq = self.stub.output[-1] 490 491 self.failUnless(xpath.matches("/iq[@type='set' and @to='%s']/query/item[@role='participant']" % (self.room_jid.userhost(),), iq), 'Wrong voice stanza') 492 493 response = toResponse(iq, 'result') 494 495 self.stub.send(response) 496 497 return d 498 499
Note: See TracChangeset
for help on using the changeset viewer.