diff options
Diffstat (limited to 'tests/twisted/avahi/request-im.py')
-rw-r--r-- | tests/twisted/avahi/request-im.py | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/tests/twisted/avahi/request-im.py b/tests/twisted/avahi/request-im.py index a61a3684..97fc3402 100644 --- a/tests/twisted/avahi/request-im.py +++ b/tests/twisted/avahi/request-im.py @@ -12,9 +12,7 @@ from servicetest import call_async, EventPattern, \ from avahitest import get_host_name, AvahiAnnouncer from xmppstream import setup_stream_listener -CHANNEL_TYPE_TEXT = 'org.freedesktop.Telepathy.Channel.Type.Text' - -HT_CONTACT = 1 +import constants as cs def test(q, bus, conn): self_name = 'testsuite' + '@' + get_host_name() @@ -39,8 +37,8 @@ def test(q, bus, conn): tp_name_prefix + '.Connection.Interface.Requests', dbus_interface='org.freedesktop.DBus.Properties') assert ({tp_name_prefix + '.Channel.ChannelType': - CHANNEL_TYPE_TEXT, - tp_name_prefix + '.Channel.TargetHandleType': HT_CONTACT, + cs.CHANNEL_TYPE_TEXT, + tp_name_prefix + '.Channel.TargetHandleType': cs.HT_CONTACT, }, [tp_name_prefix + '.Channel.TargetHandle', tp_name_prefix + '.Channel.TargetID'], @@ -48,8 +46,8 @@ def test(q, bus, conn): properties['RequestableChannelClasses'] # request a muc channel using the old API - handle = conn.RequestHandles(HT_CONTACT, [contact_name])[0] - call_async(q, conn, 'RequestChannel', CHANNEL_TYPE_TEXT, HT_CONTACT, handle, True) + handle = conn.RequestHandles(cs.HT_CONTACT, [contact_name])[0] + call_async(q, conn, 'RequestChannel', cs.CHANNEL_TYPE_TEXT, cs.HT_CONTACT, handle, True) ret, old_sig, new_sig = q.expect_many( EventPattern('dbus-return', method='RequestChannel'), @@ -64,8 +62,8 @@ def test(q, bus, conn): props = new_sig.args[0][0][1] assert props[tp_name_prefix + '.Channel.ChannelType'] ==\ - CHANNEL_TYPE_TEXT - assert props[tp_name_prefix + '.Channel.TargetHandleType'] == HT_CONTACT + cs.CHANNEL_TYPE_TEXT + assert props[tp_name_prefix + '.Channel.TargetHandleType'] == cs.HT_CONTACT assert props[tp_name_prefix + '.Channel.TargetHandle'] == handle assert props[tp_name_prefix + '.Channel.TargetID'] == contact_name assert props[tp_name_prefix + '.Channel.Requested'] == True @@ -75,8 +73,8 @@ def test(q, bus, conn): == self_name assert old_sig.args[0] == path1 - assert old_sig.args[1] == CHANNEL_TYPE_TEXT - assert old_sig.args[2] == HT_CONTACT # handle type + assert old_sig.args[1] == cs.CHANNEL_TYPE_TEXT + assert old_sig.args[2] == cs.HT_CONTACT # handle type assert old_sig.args[3] == handle # handle # Exercise basic Channel Properties from spec 0.17.7 @@ -86,10 +84,10 @@ def test(q, bus, conn): assert channel_props.get('TargetHandle') == handle,\ channel_props.get('TargetHandle') assert channel_props['TargetID'] == contact_name, channel_props - assert channel_props.get('TargetHandleType') == HT_CONTACT,\ + assert channel_props.get('TargetHandleType') == cs.HT_CONTACT,\ channel_props.get('TargetHandleType') assert channel_props.get('ChannelType') == \ - CHANNEL_TYPE_TEXT, channel_props.get('ChannelType') + cs.CHANNEL_TYPE_TEXT, channel_props.get('ChannelType') assert channel_props['Requested'] == True assert channel_props['InitiatorID'] == self_name assert channel_props['InitiatorHandle'] == conn.GetSelfHandle() @@ -105,8 +103,8 @@ def test(q, bus, conn): # create muc channel using new API call_async(q, requestotron, 'CreateChannel', { tp_name_prefix + '.Channel.ChannelType': - CHANNEL_TYPE_TEXT, - tp_name_prefix + '.Channel.TargetHandleType': HT_CONTACT, + cs.CHANNEL_TYPE_TEXT, + tp_name_prefix + '.Channel.TargetHandleType': cs.HT_CONTACT, tp_name_prefix + '.Channel.TargetID': contact_name, }) @@ -120,8 +118,8 @@ def test(q, bus, conn): props = ret.value[1] assert props[tp_name_prefix + '.Channel.ChannelType'] ==\ - CHANNEL_TYPE_TEXT - assert props[tp_name_prefix + '.Channel.TargetHandleType'] == HT_CONTACT + cs.CHANNEL_TYPE_TEXT + assert props[tp_name_prefix + '.Channel.TargetHandleType'] == cs.HT_CONTACT assert props[tp_name_prefix + '.Channel.TargetHandle'] == handle assert props[tp_name_prefix + '.Channel.TargetID'] == contact_name assert props[tp_name_prefix + '.Channel.Requested'] == True @@ -134,16 +132,16 @@ def test(q, bus, conn): assert new_sig.args[0][0][1] == props assert old_sig.args[0] == path2 - assert old_sig.args[1] == CHANNEL_TYPE_TEXT - assert old_sig.args[2] == HT_CONTACT # handle type + assert old_sig.args[1] == cs.CHANNEL_TYPE_TEXT + assert old_sig.args[2] == cs.HT_CONTACT # handle type assert old_sig.args[3] == handle # handle assert old_sig.args[4] == True # suppress handler # ensure roomlist channel yours, ensured_path, ensured_props = requestotron.EnsureChannel( { tp_name_prefix + '.Channel.ChannelType': - CHANNEL_TYPE_TEXT, - tp_name_prefix + '.Channel.TargetHandleType': HT_CONTACT, + cs.CHANNEL_TYPE_TEXT, + tp_name_prefix + '.Channel.TargetHandleType': cs.HT_CONTACT, tp_name_prefix + '.Channel.TargetHandle': handle, }) |