more info on testbot

This commit is contained in:
Aleksej 2022-06-14 01:11:35 +02:00
parent 414174985b
commit 6e40fba236
No known key found for this signature in database
GPG Key ID: 4DB9C85100A6D17F

View File

@ -37,11 +37,13 @@ def allmsgsrecv():
# Print results and exit # Print results and exit
def printandexit(): def printandexit():
print("Results of test:") print("Results of test:")
print("Room1 -> Room2:")
for i in results1: for i in results1:
if i[2] == 0: if i[2] == 0:
print(i[0] + " : Not recieved") print(i[0] + " : Not recieved")
else: else:
print(i[0].rstrip() + " : " + str(round(i[2]-i[1],2)) + " secounds") print(i[0].rstrip() + " : " + str(round(i[2]-i[1],2)) + " secounds")
print("Room2 -> Room1:")
for i in results2: for i in results2:
if i[2] == 0: if i[2] == 0:
print(i[0] + " : Not recieved") print(i[0] + " : Not recieved")
@ -122,6 +124,13 @@ if __name__ == '__main__':
NICK = config.get('credentials', 'NICK') NICK = config.get('credentials', 'NICK')
ROOM1 = config.get('credentials', 'ROOM1') ROOM1 = config.get('credentials', 'ROOM1')
ROOM2 = config.get('credentials', 'ROOM2') ROOM2 = config.get('credentials', 'ROOM2')
HOST = None
PORT = 5222
if "host" in config.options('credentials'):
HOST = config.get('credentials', 'HOST')
if "port" in config.options('credentials'):
PORT = config.get('credentials', 'PORT')
xmpp = MUCBot(JID, PASSWORD, NICK, ROOM1, ROOM2) xmpp = MUCBot(JID, PASSWORD, NICK, ROOM1, ROOM2)
@ -130,6 +139,9 @@ if __name__ == '__main__':
xmpp.register_plugin('xep_0199') # XMPP Ping xmpp.register_plugin('xep_0199') # XMPP Ping
# Connect to the XMPP server and start processing XMPP stanzas. # Connect to the XMPP server and start processing XMPP stanzas.
xmpp.connect(address=("127.0.0.1",25222)) if HOST != None:
xmpp.connect(address=(HOST,int(PORT)))
else:
xmpp.connect()
xmpp.process(forever=False) xmpp.process(forever=False)