Changeset 58:a8c2aadabebd for wokkel/test/test_pubsub.py
- Timestamp:
- Apr 22, 2009, 5:02:49 PM (13 years ago)
- Branch:
- default
- Convert:
- svn:b33ecbfc-034c-dc11-8662-000475d9059e/trunk@170
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
wokkel/test/test_pubsub.py
r57 r58 256 256 257 257 258 def test_createNodeWithSender(self): 259 """ 260 Test sending create request from a specific JID. 261 """ 262 263 d = self.protocol.createNode(JID('pubsub.example.org'), 'test', 264 sender=JID('user@example.org')) 265 266 iq = self.stub.output[-1] 267 self.assertEquals('user@example.org', iq['from']) 268 269 response = toResponse(iq, 'result') 270 self.stub.send(response) 271 return d 272 273 258 274 def test_deleteNode(self): 259 275 """ … … 273 289 child = children[0] 274 290 self.assertEquals('test', child['node']) 291 292 response = toResponse(iq, 'result') 293 self.stub.send(response) 294 return d 295 296 297 def test_deleteNodeWithSender(self): 298 """ 299 Test sending delete request. 300 """ 301 302 d = self.protocol.deleteNode(JID('pubsub.example.org'), 'test', 303 sender=JID('user@example.org')) 304 305 iq = self.stub.output[-1] 306 self.assertEquals('user@example.org', iq['from']) 275 307 276 308 response = toResponse(iq, 'result') … … 330 362 331 363 364 def test_publishWithSender(self): 365 """ 366 Test sending publish request from a specific JID. 367 """ 368 369 item = pubsub.Item() 370 d = self.protocol.publish(JID('pubsub.example.org'), 'test', [item], 371 JID('user@example.org')) 372 373 iq = self.stub.output[-1] 374 self.assertEquals('user@example.org', iq['from']) 375 376 response = toResponse(iq, 'result') 377 self.stub.send(response) 378 return d 379 380 332 381 def test_subscribe(self): 333 382 """ … … 399 448 400 449 450 def test_subscribeWithSender(self): 451 """ 452 Test sending subscription request from a specific JID. 453 """ 454 d = self.protocol.subscribe(JID('pubsub.example.org'), 'test', 455 JID('user@example.org'), 456 sender=JID('user@example.org')) 457 458 iq = self.stub.output[-1] 459 self.assertEquals('user@example.org', iq['from']) 460 461 response = toResponse(iq, 'result') 462 pubsub = response.addElement((NS_PUBSUB, 'pubsub')) 463 subscription = pubsub.addElement('subscription') 464 subscription['node'] = 'test' 465 subscription['jid'] = 'user@example.org' 466 subscription['subscription'] = 'subscribed' 467 self.stub.send(response) 468 return d 469 470 401 471 def test_unsubscribe(self): 402 472 """ … … 422 492 423 493 494 def test_unsubscribeWithSender(self): 495 """ 496 Test sending unsubscription request from a specific JID. 497 """ 498 d = self.protocol.unsubscribe(JID('pubsub.example.org'), 'test', 499 JID('user@example.org'), 500 sender=JID('user@example.org')) 501 502 iq = self.stub.output[-1] 503 self.assertEquals('user@example.org', iq['from']) 504 self.stub.send(toResponse(iq, 'result')) 505 return d 506 507 424 508 def test_items(self): 425 509 """ … … 485 569 self.stub.send(response) 486 570 571 return d 572 573 574 def test_itemsWithSender(self): 575 """ 576 Test sending items request from a specific JID. 577 """ 578 579 d = self.protocol.items(JID('pubsub.example.org'), 'test', 580 sender=JID('user@example.org')) 581 582 iq = self.stub.output[-1] 583 self.assertEquals('user@example.org', iq['from']) 584 585 response = toResponse(iq, 'result') 586 items = response.addElement((NS_PUBSUB, 'pubsub')).addElement('items') 587 items['node'] = 'test' 588 589 self.stub.send(response) 487 590 return d 488 591
Note: See TracChangeset
for help on using the changeset viewer.