import threading
import unittest
from slixmpp.test import SlixTest
class TestStreamSet(SlixTest):
def tearDown(self):
self.stream_close()
def testHandleSoftwareVersionRequest(self):
self.stream_start(mode='client', plugins=['xep_0030', 'xep_0092'])
self.xmpp['xep_0092'].name = 'Slixmpp'
self.xmpp['xep_0092'].version = 'dev'
self.xmpp['xep_0092'].os = 'Linux'
self.recv("""
""")
self.send("""
Slixmpp
dev
Linux
""")
def testMakeSoftwareVersionRequest(self):
results = []
def query():
r = self.xmpp['xep_0092'].get_version('foo@bar')
results.append((r['software_version']['name'],
r['software_version']['version'],
r['software_version']['os']))
self.stream_start(mode='client', plugins=['xep_0030', 'xep_0092'])
t = threading.Thread(target=query)
t.start()
self.send("""
""")
self.recv("""
Foo
1.0
Linux
""")
t.join()
expected = [('Foo', '1.0', 'Linux')]
self.assertEqual(results, expected,
"Did not receive expected results: %s" % results)
suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamSet)