[Telepathy-commits] [telepathy-gabble/master] test-content-adding-removal.py: use constants instead of hardcoded numbers
Senko Rasic
senko.rasic at collabora.co.uk
Tue Jan 20 03:24:20 PST 2009
---
tests/twisted/constants.py | 7 +++++++
.../twisted/jingle/test-content-adding-removal.py | 13 +++++++------
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index 5871998..b65c618 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -36,3 +36,10 @@ TUBE_CHANNEL_STATE_LOCAL_PENDING = 0
TUBE_CHANNEL_STATE_REMOTE_PENDING = 1
TUBE_CHANNEL_STATE_OPEN = 2
TUBE_CHANNEL_STATE_NOT_OFFERED = 3
+
+MEDIA_STREAM_TYPE_AUDIO = 0
+MEDIA_STREAM_TYPE_VIDEO = 1
+MEDIA_STREAM_STATE_DISCONNECTED = 0
+MEDIA_STREAM_STATE_CONNECTING = 1
+MEDIA_STREAM_STATE_CONNECTED = 2
+
diff --git a/tests/twisted/jingle/test-content-adding-removal.py b/tests/twisted/jingle/test-content-adding-removal.py
index fdac485..fd04836 100644
--- a/tests/twisted/jingle/test-content-adding-removal.py
+++ b/tests/twisted/jingle/test-content-adding-removal.py
@@ -17,6 +17,7 @@ import jingletest
import gabbletest
import dbus
import time
+from constants import *
def test(q, bus, conn, stream):
@@ -58,7 +59,7 @@ def test(q, bus, conn, stream):
# This is the interesting part of this test
- media_iface.RequestStreams(handle, [0]) # 0 == MEDIA_STREAM_TYPE_AUDIO
+ media_iface.RequestStreams(handle, [MEDIA_STREAM_TYPE_AUDIO])
# S-E gets notified about new session handler, and calls Ready on it
e = q.expect('dbus-signal', signal='NewSessionHandler')
@@ -76,7 +77,7 @@ def test(q, bus, conn, stream):
# Before sending the initiate, request another stream
- media_iface.RequestStreams(handle, [1]) # 0 == MEDIA_STREAM_TYPE_VIDEO
+ media_iface.RequestStreams(handle, [MEDIA_STREAM_TYPE_VIDEO])
e = q.expect('dbus-signal', signal='NewStreamHandler')
stream_id2 = e.args[1]
@@ -85,9 +86,9 @@ def test(q, bus, conn, stream):
# We set both streams as ready, which will trigger the session invite
stream_handler.Ready(jt.get_audio_codecs_dbus())
- stream_handler.StreamState(2)
+ stream_handler.StreamState(MEDIA_STREAM_STATE_CONNECTED)
stream_handler2.Ready(jt.get_audio_codecs_dbus())
- stream_handler2.StreamState(2)
+ stream_handler2.StreamState(MEDIA_STREAM_STATE_CONNECTED)
# We changed our mind locally, don't want video
media_iface.RemoveStreams([stream_id2])
@@ -113,7 +114,7 @@ def test(q, bus, conn, stream):
q.expect('dbus-signal', signal='StreamRemoved')
- media_iface.RequestStreams(handle, [1]) # 1 == MEDIA_STREAM_TYPE_VIDEO
+ media_iface.RequestStreams(handle, [MEDIA_STREAM_TYPE_VIDEO])
e = q.expect('dbus-signal', signal='NewStreamHandler')
stream2_id = e.args[1]
@@ -122,7 +123,7 @@ def test(q, bus, conn, stream):
stream_handler2.NewNativeCandidate("fake", jt.get_remote_transports_dbus())
stream_handler2.Ready(jt.get_audio_codecs_dbus())
- stream_handler2.StreamState(2)
+ stream_handler2.StreamState(MEDIA_STREAM_STATE_CONNECTED)
e = q.expect('stream-iq')
assert e.query.name == 'jingle'
--
1.5.6.5
More information about the Telepathy-commits
mailing list