diff options
author | Mikhail Zabaluev <mikhail.zabaluev@nokia.com> | 2011-08-25 15:46:07 +0300 |
---|---|---|
committer | Mikhail Zabaluev <mikhail.zabaluev@nokia.com> | 2011-08-25 15:46:07 +0300 |
commit | cb9453be492f28cf7b12c53f10b639ee9c56ed0f (patch) | |
tree | 589acc246ee600f0e130009cfb29e15ac25f986e | |
parent | 31cf52edc55fab3843e8b664a6da158afdb0aba1 (diff) |
Exercise StartTones and StopTones in tests
-rw-r--r-- | tests/twisted/voip/dtmf.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/twisted/voip/dtmf.py b/tests/twisted/voip/dtmf.py index 2e90717..4369bc3 100644 --- a/tests/twisted/voip/dtmf.py +++ b/tests/twisted/voip/dtmf.py @@ -4,7 +4,7 @@ Test DTMF dialstring playback and signalling. from sofiatest import exec_test from servicetest import ( - wrap_channel, EventPattern, + call_async, wrap_channel, EventPattern, assertEquals, assertContains, assertLength, assertSameSets ) from voip_test import VoipTestContext @@ -130,6 +130,31 @@ def multiple_tones(q, bus, conn, sip_proxy, peer='foo@bar.com'): q.expect('dbus-signal', signal='StoppedTones', args=[False]) +def bleep_bloop(q, bus, conn, sip_proxy, peer='foo@bar.com'): + + context = VoipTestContext(q, conn, bus, sip_proxy, 'sip:testacc@127.0.0.1', peer) + + chan = setup_dtmf_channel(context) + + call_async(q, chan.DTMF, 'StartTone', 666, 3) + q.expect_many( + EventPattern('dbus-signal', signal='StartTelephonyEvent'), + EventPattern('dbus-signal', signal='SendingTones', args=['3']), + EventPattern('dbus-return', method='StartTone'), + ) + + assertEquals(True, chan.Properties.Get(cs.CHANNEL_IFACE_DTMF, 'CurrentlySendingTones')) + + call_async(q, chan.DTMF, 'StopTone', 666) + q.expect_many( + EventPattern('dbus-signal', signal='StopTelephonyEvent'), + EventPattern('dbus-signal', signal='StoppedTones', args=[True]), + EventPattern('dbus-return', method='StopTone'), + ) + + assertEquals(False, chan.Properties.Get(cs.CHANNEL_IFACE_DTMF, 'CurrentlySendingTones')) + if __name__ == '__main__': exec_test(request_initial_tones) exec_test(multiple_tones) + exec_test(bleep_bloop) |