Changeset 110:ddf5580b7128 for wokkel/test/test_muc.py
- Timestamp:
- Oct 1, 2008, 11:11:06 PM (14 years ago)
- Branch:
- wokkel-muc-client-support-24
- Convert:
- svn:b33ecbfc-034c-dc11-8662-000475d9059e/branches/wokkel-muc-client-support-24@71
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wokkel/test/test_muc.py
r109 r110 49 49 self.protocol.xmlstream = self.stub.xmlstream 50 50 self.protocol.connectionInitialized() 51 51 self.test_room = 'test' 52 self.test_srv = 'conference.example.org' 53 self.test_nick = 'Nick' 54 55 self.room_jid = JID(self.test_room+'@'+self.test_srv+'/'+self.test_nick) 52 56 53 57 def test_interface(self): … … 120 124 """Test joining a room 121 125 """ 122 test_room = 'test' 123 test_srv = 'conference.example.org' 124 test_nick = 'Nick' 126 125 127 126 128 def cb(room): 127 self.assertEquals( test_room, room.name)128 129 d = self.protocol.join( test_srv, test_room,test_nick)129 self.assertEquals(self.test_room, room.name) 130 131 d = self.protocol.join(self.test_srv, self.test_room, self.test_nick) 130 132 d.addCallback(cb) 131 133 … … 135 137 136 138 # send back user presence, they joined 137 response = muc.UserPresence(frm= test_room+'@'+test_srv+'/'+test_nick)139 response = muc.UserPresence(frm=self.test_room+'@'+self.test_srv+'/'+self.test_nick) 138 140 self.stub.send(response) 139 141 return d … … 143 145 """Test joining a room and getting an error 144 146 """ 145 test_room = 'test'146 test_srv = 'conference.example.org'147 test_nick = 'Nick'148 147 149 148 def cb(error): … … 152 151 153 152 154 d = self.protocol.join( test_srv, test_room,test_nick)153 d = self.protocol.join(self.test_srv, self.test_room, self.test_nick) 155 154 d.addBoth(cb) 156 155 … … 163 162 'forbidden' 164 163 ), 165 frm= test_room+'@'+test_srv+'/'+test_nick)164 frm=self.room_jid.full()) 166 165 self.stub.send(response) 167 166 return d 168 167 168 def test_partRoom(self): 169 self.fail('Not Implemented') 170 171 172 def test_ban(self): 173 174 self.fail('Not Implemented') 175 176 def test_kick(self): 177 self.fail('Not Implemented') 178 179 180 def test_password(self): 181 """Test sending a password via presence to a password protected room. 182 """ 183 184 185 self.fail('Not Implemented') 186 187 def test_history(self): 188 189 self.fail('Not Implemented') 190 191 192 def test_oneToOneChat(self): 193 """Test converting a one to one chat 194 """ 195 archive = [] 196 thread = "e0ffe42b28561960c6b12b944a092794b9683a38" 197 # create messages 198 msg = domish.Element((None, 'message')) 199 msg['to'] = 'testing@example.com' 200 msg['type'] = 'chat' 201 msg.addElement('body', None, 'test') 202 msg.addElement('thread', None, thread) 203 204 archive.append(msg) 205 206 msg = domish.Element((None, 'message')) 207 msg['to'] = 'testing2@example.com' 208 msg['type'] = 'chat' 209 msg.addElement('body', None, 'yo') 210 msg.addElement('thread', None, thread) 211 212 archive.append(msg) 213 214 self.protocol.history(self.room_jid.userhost(), archive) 215 216 217 while len(self.stub.output)>0: 218 m = self.stub.output.pop() 219 # check for delay element 220 self.failUnless(m.name=='message', 'Wrong stanza') 221 self.failUnless(xpath.matches("/message/delay", m), 'Invalid history stanza') 222 223 224 def test_invite(self): 225 self.fail('Not Implemented') 226 227 228 def test_privateMessage(self): 229 self.fail('Not Implemented') 230 231 def test_register(self): 232 self.fail('Not Implemented') 233 234 def test_voice(self): 235 236 self.protocol.voice(self.room_jid.userhost()) 237 238 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 242 self.failUnless(xpath.matches("/message/x[@type='submit']/field/value[text()='%s']" % (muc.NS_REQUEST,), m), 'Invalid voice message stanza') 243 244 169 245 def test_roomConfigure(self): 170 246 171 test_room = 'test' 172 test_srv = 'conference.example.org' 173 test_nick = 'Nick' 174 175 self.fail('Not Implemented') 176 177 247 self.fail('Not Implemented') 248 249
Note: See TracChangeset
for help on using the changeset viewer.