2
Test that requests for Tubes and StreamTube channels to ids which aren't
3
actually on the network fail gracefully with NotAvailable
6
from saluttest import exec_test
8
from constants import (
9
HT_CONTACT, CONN_IFACE_REQUESTS,
10
CHANNEL_TYPE, TARGET_HANDLE_TYPE, TARGET_HANDLE,
11
CHANNEL_TYPE_TUBES, CHANNEL_TYPE_STREAM_TUBE,
17
arbitrary_ids = [ "DooN4Bei@TheeK6bo-Tegh4aci", "ahrui1iM@Dai6igho-ADetaes3" ]
19
print "FIXME: test-to-nonexistant-ids.py disabled because 1-1 tubes are disabled for now"
20
# exiting 77 causes automake to consider the test to have been skipped
23
def test(q, bus, conn):
25
q.expect('dbus-signal', signal='StatusChanged', args=[0L, 0L])
27
h1, h2 = conn.RequestHandles(HT_CONTACT, arbitrary_ids)
30
conn.RequestChannel(CHANNEL_TYPE_TUBES, HT_CONTACT, h1, True)
31
except dbus.DBusException, e:
32
assert e.get_dbus_name() == NOT_AVAILABLE, e.get_dbus_name()
34
assert False, "Should raise NotAvailable error"
36
requestotron = dbus.Interface(conn, CONN_IFACE_REQUESTS)
39
requestotron.CreateChannel({
40
CHANNEL_TYPE: CHANNEL_TYPE_STREAM_TUBE,
41
TARGET_HANDLE_TYPE: HT_CONTACT,
43
CHANNEL_TYPE_STREAM_TUBE + ".Service": "com.example",
45
except dbus.DBusException, e:
46
assert e.get_dbus_name() == NOT_AVAILABLE, e.get_dbus_name()
48
assert False, "Should raise NotAvailable error"
51
q.expect('dbus-signal', signal='StatusChanged', args=[2, 1])
53
if __name__ == '__main__':