Files
@ 4ce77ae70b45
Branch filter:
Location: libtransport.git/spectrum/src/tests/muc_pm.py - annotation
4ce77ae70b45
2.0 KiB
text/x-python
Disable prosody debug and enable IRC tests again
efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc ba5c6ce41e34 efd14b776ccc efd14b776ccc efd14b776ccc ba5c6ce41e34 ba5c6ce41e34 ba5c6ce41e34 ba5c6ce41e34 ba5c6ce41e34 ba5c6ce41e34 efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc ba5c6ce41e34 ba5c6ce41e34 efd14b776ccc efd14b776ccc efd14b776ccc ba5c6ce41e34 ba5c6ce41e34 ba5c6ce41e34 ba5c6ce41e34 efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc efd14b776ccc | import optparse
import sys
import time
import subprocess
import os
import sleekxmpp
class Responder(sleekxmpp.ClientXMPP):
def __init__(self, jid, password, room, nick):
sleekxmpp.ClientXMPP.__init__(self, jid, password)
self.room = room
self.nick = nick
self.finished = False
self.add_event_handler("session_start", self.start)
self.add_event_handler("message", self.message)
self.tests = {}
def message(self, msg):
if msg['body'] == "abc" and msg['from'] == self.room + "/client":
self.send_message(mto=self.room + "/client",
mbody="echo %s" % msg['body'],
mtype='chat')
elif msg['body'] == "def" and msg['from'] == self.room + "/client":
self.send_message(mto=self.room + "/client",
mbody="echo %s" % msg['body'],
mtype='chat')
else:
self.finished = True
def start(self, event):
self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True)
class Client(sleekxmpp.ClientXMPP):
def __init__(self, jid, password, room, nick):
sleekxmpp.ClientXMPP.__init__(self, jid, password)
self.room = room
self.nick = nick
self.add_event_handler("session_start", self.start)
self.add_event_handler("message", self.message)
self.finished = False
self.tests = {}
self.tests["echo1_received"] = ["libcommuni: Send and receive private messages - 1st msg", False]
self.tests["echo2_received"] = ["libcommuni: Send and receive private messages - 2nd msg", False]
def message(self, msg):
if msg['body'] == "echo abc" and msg['from'] == self.room + "/responder":
self.tests["echo1_received"][1] = True
self.send_message(mto=self.room + "/responder", mbody="def", mtype='chat')
elif msg['body'] == "echo def" and msg['from'] == self.room + "/responder":
self.tests["echo2_received"][1] = True
self.finished = True
def start(self, event):
self.getRoster()
self.sendPresence()
self.plugin['xep_0045'].joinMUC(self.room, self.nick, wait=True)
self.send_message(mto=self.room + "/responder", mbody="abc", mtype='chat')
|