summaryrefslogtreecommitdiff
path: root/tests/test_stream_xep_0092.py
diff options
context:
space:
mode:
authorLance Stout <lancestout@gmail.com>2011-01-09 10:04:09 -0500
committerLance Stout <lancestout@gmail.com>2011-01-09 10:04:09 -0500
commit23e499998fc36b377e3adb77d3d59f885d94f21d (patch)
tree3dcef998633c65ea320cd2acfdaadb394e4ee773 /tests/test_stream_xep_0092.py
parentc156a4f723073e1e6394803b5bb1613227947266 (diff)
parentacdf9e2d22dd604578f50d0a9b67c47e001da69f (diff)
downloadslixmpp-23e499998fc36b377e3adb77d3d59f885d94f21d.tar.gz
slixmpp-23e499998fc36b377e3adb77d3d59f885d94f21d.tar.bz2
slixmpp-23e499998fc36b377e3adb77d3d59f885d94f21d.tar.xz
slixmpp-23e499998fc36b377e3adb77d3d59f885d94f21d.zip
Merge branch 'develop' into roster
Diffstat (limited to 'tests/test_stream_xep_0092.py')
-rw-r--r--tests/test_stream_xep_0092.py69
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/test_stream_xep_0092.py b/tests/test_stream_xep_0092.py
new file mode 100644
index 00000000..4a038558
--- /dev/null
+++ b/tests/test_stream_xep_0092.py
@@ -0,0 +1,69 @@
+import threading
+
+from sleekxmpp.test import *
+
+
+class TestStreamSet(SleekTest):
+
+ def tearDown(self):
+ self.stream_close()
+
+ def testHandleSoftwareVersionRequest(self):
+ self.stream_start(mode='client', plugins=['xep_0030', 'xep_0092'])
+
+ self.xmpp['xep_0092'].name = 'SleekXMPP'
+ self.xmpp['xep_0092'].version = 'dev'
+ self.xmpp['xep_0092'].os = 'Linux'
+
+ self.recv("""
+ <iq type="get" id="1">
+ <query xmlns="jabber:iq:version" />
+ </iq>
+ """)
+
+ self.send("""
+ <iq type="result" id="1">
+ <query xmlns="jabber:iq:version">
+ <name>SleekXMPP</name>
+ <version>dev</version>
+ <os>Linux</os>
+ </query>
+ </iq>
+ """)
+
+ def testMakeSoftwareVersionRequest(self):
+ results = []
+
+ def query():
+ r = self.xmpp['xep_0092'].get_version('foo@bar')
+ results.append(r)
+
+ self.stream_start(mode='client', plugins=['xep_0030', 'xep_0092'])
+
+ t = threading.Thread(target=query)
+ t.start()
+
+ self.send("""
+ <iq type="get" id="1" to="foo@bar">
+ <query xmlns="jabber:iq:version" />
+ </iq>
+ """)
+
+ self.recv("""
+ <iq type="result" id="1" from="foo@bar" to="tester@localhost">
+ <query xmlns="jabber:iq:version">
+ <name>Foo</name>
+ <version>1.0</version>
+ <os>Linux</os>
+ </query>
+ </iq>
+ """)
+
+ t.join()
+
+ expected = [{'name': 'Foo', 'version': '1.0', 'os':'Linux'}]
+ self.assertEqual(results, expected,
+ "Did not receive expected results: %s" % results)
+
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestStreamSet)