summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMikhail Zabaluev <mikhail.zabaluev@nokia.com>2011-08-24 14:14:45 +0300
committerMikhail Zabaluev <mikhail.zabaluev@nokia.com>2011-08-24 15:23:57 +0300
commit3f3a3dfd968749732ac8f15f575467c15686e9ef (patch)
treeaf21110d5b78419ae4f86f4beaf19788b84b01f9 /tests
parent3d61bd0debe0dba5056fad3227c84cac43865e93 (diff)
Add a test for DTMF InitialTones property
Diffstat (limited to 'tests')
-rw-r--r--tests/twisted/Makefile.am1
-rw-r--r--tests/twisted/constants.py3
-rw-r--r--tests/twisted/voip/dtmf.py37
-rw-r--r--tests/twisted/voip/outgoing-basics.py7
4 files changed, 45 insertions, 3 deletions
diff --git a/tests/twisted/Makefile.am b/tests/twisted/Makefile.am
index e8528a4..36acc5d 100644
--- a/tests/twisted/Makefile.am
+++ b/tests/twisted/Makefile.am
@@ -11,6 +11,7 @@ TWISTED_TESTS = \
text/initiate-requestotron.py \
voip/incoming-basics.py \
voip/outgoing-basics.py \
+ voip/dtmf.py \
$(NULL)
TESTS =
diff --git a/tests/twisted/constants.py b/tests/twisted/constants.py
index 1ffa4d8..c590b3d 100644
--- a/tests/twisted/constants.py
+++ b/tests/twisted/constants.py
@@ -17,6 +17,7 @@ CHANNEL = "org.freedesktop.Telepathy.Channel"
CHANNEL_IFACE_CALL_STATE = CHANNEL + ".Interface.CallState"
CHANNEL_IFACE_CHAT_STATE = CHANNEL + '.Interface.ChatState'
CHANNEL_IFACE_DESTROYABLE = CHANNEL + ".Interface.Destroyable"
+CHANNEL_IFACE_DTMF = CHANNEL + ".Interface.DTMF"
CHANNEL_IFACE_GROUP = CHANNEL + ".Interface.Group"
CHANNEL_IFACE_HOLD = CHANNEL + ".Interface.Hold"
CHANNEL_IFACE_MEDIA_SIGNALLING = CHANNEL + ".Interface.MediaSignalling"
@@ -63,6 +64,8 @@ CALL_INITIAL_AUDIO = CHANNEL_TYPE_CALL + '.InitialAudio'
CALL_INITIAL_VIDEO = CHANNEL_TYPE_CALL + '.InitialVideo'
CALL_MUTABLE_CONTENTS = CHANNEL_TYPE_CALL + '.MutableContents'
+DTMF_INITIAL_TONES = CHANNEL_IFACE_DTMF + '.InitialTones'
+
CALL_CONTENT = 'org.freedesktop.Telepathy.Call.Content.DRAFT'
CALL_CONTENT_IFACE_MEDIA = \
'org.freedesktop.Telepathy.Call.Content.Interface.Media.DRAFT'
diff --git a/tests/twisted/voip/dtmf.py b/tests/twisted/voip/dtmf.py
new file mode 100644
index 0000000..23b3b7f
--- /dev/null
+++ b/tests/twisted/voip/dtmf.py
@@ -0,0 +1,37 @@
+"""
+Test DTMF dialstring playback and signalling.
+"""
+
+from sofiatest import exec_test
+from servicetest import (
+ wrap_channel,
+ assertEquals, assertContains, assertLength, assertSameSets
+ )
+
+import constants as cs
+
+def request_initial_tones(q, bus, conn, sip_proxy, peer='foo@bar.com'):
+ conn.Connect()
+ q.expect('dbus-signal', signal='StatusChanged', args=[0, 1])
+
+ path = conn.Requests.CreateChannel({
+ cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAMED_MEDIA,
+ cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
+ cs.TARGET_ID: peer,
+ cs.INITIAL_AUDIO: True,
+ cs.DTMF_INITIAL_TONES: '1234',
+ })[0]
+
+ chan = wrap_channel(bus.get_object(conn.bus_name, path), 'StreamedMedia',
+ ['DTMF'])
+
+ channel_props = chan.Properties.GetAll(cs.CHANNEL)
+
+ assertContains(cs.CHANNEL_IFACE_DTMF, channel_props['Interfaces'])
+
+ dtmf_props = chan.Properties.GetAll(cs.CHANNEL_IFACE_DTMF)
+
+ assertEquals('1234', dtmf_props['InitialTones'])
+
+if __name__ == '__main__':
+ exec_test(request_initial_tones)
diff --git a/tests/twisted/voip/outgoing-basics.py b/tests/twisted/voip/outgoing-basics.py
index f09a59b..057b8ca 100644
--- a/tests/twisted/voip/outgoing-basics.py
+++ b/tests/twisted/voip/outgoing-basics.py
@@ -9,7 +9,7 @@ from sofiatest import exec_test
from servicetest import (
make_channel_proxy, wrap_channel,
EventPattern, call_async,
- assertEquals, assertContains, assertLength,
+ assertEquals, assertContains, assertLength, assertSameSets
)
import constants as cs
from voip_test import VoipTestContext
@@ -272,12 +272,13 @@ def rccs(q, bus, conn, stream):
expected_allowed = [
cs.TARGET_ID, cs.TARGET_HANDLE,
- cs.INITIAL_VIDEO, cs.INITIAL_AUDIO
+ cs.INITIAL_VIDEO, cs.INITIAL_AUDIO,
+ cs.DTMF_INITIAL_TONES
]
allowed.sort()
expected_allowed.sort()
- assertEquals(expected_allowed, allowed)
+ assertSameSets(expected_allowed, allowed)
if __name__ == '__main__':