[Telepathy-commits] [telepathy-gabble/master] Use constants.py and ns.py in wait-for-caps tests
Will Thompson
will.thompson at collabora.co.uk
Wed Feb 4 06:33:07 PST 2009
---
tests/twisted/constants.py | 1 +
.../jingle/test-wait-for-caps-incomplete.py | 13 +++++++------
tests/twisted/jingle/test-wait-for-caps.py | 11 ++++++-----
3 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index 10a7bd2..4f07a73 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -14,6 +14,7 @@ CHANNEL_TYPE_TUBES = CHANNEL + ".Type.Tubes"
CHANNEL_IFACE_TUBE = CHANNEL + ".Interface.Tube.DRAFT"
CHANNEL_TYPE_STREAM_TUBE = CHANNEL + ".Type.StreamTube.DRAFT"
CHANNEL_TYPE_DBUS_TUBE = CHANNEL + ".Type.DBusTube.DRAFT"
+CHANNEL_TYPE_STREAMED_MEDIA = CHANNEL + ".Type.StreamedMedia"
CHANNEL_TYPE_TEXT = CHANNEL + ".Type.Text"
CHANNEL_TYPE = CHANNEL + '.ChannelType'
diff --git a/tests/twisted/jingle/test-wait-for-caps-incomplete.py b/tests/twisted/jingle/test-wait-for-caps-incomplete.py
index 1d0fa47..1f65411 100644
--- a/tests/twisted/jingle/test-wait-for-caps-incomplete.py
+++ b/tests/twisted/jingle/test-wait-for-caps-incomplete.py
@@ -14,7 +14,7 @@ import gabbletest
import dbus
import time
-import constants
+import constants as cs
def test(q, bus, conn, stream):
jt = jingletest.JingleTest(stream, 'test at localhost', 'foo at bar.com/Foo')
@@ -38,10 +38,10 @@ def test(q, bus, conn, stream):
# unsure whether to treat contact as offline for this purpose, it
# will tentatively allow channel creation and contact handle addition
- handle = conn.RequestHandles(1, [jt.remote_jid])[0]
+ handle = conn.RequestHandles(cs.HT_CONTACT, [jt.remote_jid])[0]
- path = conn.RequestChannel(
- 'org.freedesktop.Telepathy.Channel.Type.StreamedMedia', 1, handle, True)
+ path = conn.RequestChannel(cs.CHANNEL_TYPE_STREAMED_MEDIA, cs.HT_CONTACT,
+ handle, True)
media_iface = make_channel_proxy(conn, path, 'Channel.Type.StreamedMedia')
# So it turns out that the calls to RequestStreams and Disconnect could be
@@ -53,13 +53,14 @@ def test(q, bus, conn, stream):
sync_dbus(bus, q, conn)
# Now we request streams before either <presence> or caps have arrived
- call_async(q, media_iface, 'RequestStreams', handle, [0]) # req audio stream
+ call_async(q, media_iface, 'RequestStreams', handle,
+ [cs.MEDIA_STREAM_TYPE_AUDIO])
conn.Disconnect()
# RequestStreams should now return NotAvailable
event = q.expect('dbus-error', method='RequestStreams')
- assert event.error.get_dbus_name() == constants.NOT_AVAILABLE, event.error
+ assert event.error.get_dbus_name() == cs.NOT_AVAILABLE, event.error
q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
diff --git a/tests/twisted/jingle/test-wait-for-caps.py b/tests/twisted/jingle/test-wait-for-caps.py
index 4f13990..da0b179 100644
--- a/tests/twisted/jingle/test-wait-for-caps.py
+++ b/tests/twisted/jingle/test-wait-for-caps.py
@@ -14,6 +14,8 @@ import gabbletest
import dbus
import time
+import constants as cs
+import ns
def test(q, bus, conn, stream):
jt = jingletest.JingleTest(stream, 'test at localhost', 'foo at bar.com/Foo')
@@ -37,10 +39,10 @@ def test(q, bus, conn, stream):
# unsure whether to treat contact as offline for this purpose, it
# will tentatively allow channel creation and contact handle addition
- handle = conn.RequestHandles(1, [jt.remote_jid])[0]
+ handle = conn.RequestHandles(cs.HT_CONTACT, [jt.remote_jid])[0]
- path = conn.RequestChannel(
- 'org.freedesktop.Telepathy.Channel.Type.StreamedMedia', 1, handle, True)
+ path = conn.RequestChannel(cs.CHANNEL_TYPE_STREAMED_MEDIA, cs.HT_CONTACT,
+ handle, True)
media_iface = make_channel_proxy(conn, path, 'Channel.Type.StreamedMedia')
# Now we request streams before either <presence> or caps have arrived
@@ -62,8 +64,7 @@ def test(q, bus, conn, stream):
jt.send_remote_presence()
# Gabble doesn't trust it, so makes a disco
- event = q.expect('stream-iq', query_ns='http://jabber.org/protocol/disco#info',
- to='foo at bar.com/Foo')
+ event = q.expect('stream-iq', query_ns=ns.DISCO_INFO, to='foo at bar.com/Foo')
jt.send_remote_disco_reply(event.stanza)
--
1.5.6.5
More information about the telepathy-commits
mailing list