/usr/lib/telepathy-gabble-tests/twisted/tubes/create-invalid-tube-channels.py is in telepathy-gabble-tests 0.18.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | """
Check that Gabble rejects invalid requests for tubes channels.
"""
import dbus
from servicetest import call_async
from gabbletest import exec_test
import constants as cs
def is_tube(path, props):
ct = props[cs.CHANNEL_TYPE]
return ct in [cs.CHANNEL_TYPE_STREAM_TUBE, cs.CHANNEL_TYPE_DBUS_TUBE]
def check_no_tubes(conn_props):
channels = conn_props.Get(cs.CONN_IFACE_REQUESTS, 'Channels')
tube_channels = filter(is_tube, channels)
assert len(tube_channels) == 0, tube_channels
def test(q, bus, conn, stream):
conn_props = dbus.Interface(conn, cs.PROPERTIES_IFACE)
# Try to CreateChannel with unknown properties
# Gabble must return an error
call_async(q, conn.Requests, 'CreateChannel',
{cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAM_TUBE,
cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
cs.TARGET_ID: "foo@example.com",
'this.property.does.not.exist': 'this.value.should.not.exist'
})
ret = q.expect('dbus-error', method='CreateChannel')
check_no_tubes(conn_props)
# Try to CreateChannel with missing properties ("Service")
# Gabble must return an error
call_async(q, conn.Requests, 'CreateChannel',
{cs.CHANNEL_TYPE: cs.CHANNEL_TYPE_STREAM_TUBE,
cs.TARGET_HANDLE_TYPE: cs.HT_CONTACT,
cs.TARGET_ID: "foo@example.com",
})
ret = q.expect('dbus-error', method='CreateChannel')
check_no_tubes(conn_props)
if __name__ == '__main__':
exec_test(test)
|