/usr/lib/telepathy-gabble-tests/twisted/jingle-share/test-receive-file-and-sender-disconnect-while-pending.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 48 49 50 51 52 53 54 55 56 57 58 | import dbus
import constants as cs
from file_transfer_helper import SendFileTest, ReceiveFileTest, \
FileTransferTest, exec_file_transfer_test
from config import JINGLE_FILE_TRANSFER_ENABLED
if not JINGLE_FILE_TRANSFER_ENABLED:
print "NOTE: built with --disable-file-transfer or --disable-voip"
raise SystemExit(77)
class ReceiveFileAndSenderDisconnectWhilePendingTest(ReceiveFileTest):
def accept_file(self):
e = self.q.expect('dbus-signal', signal='FileTransferStateChanged',
path = self.channel.object_path,
args=[cs.FT_STATE_CANCELLED, \
cs.FT_STATE_CHANGE_REASON_REMOTE_STOPPED])
# We can't accept the transfer now
try:
self.ft_channel.AcceptFile(cs.SOCKET_ADDRESS_TYPE_UNIX,
cs.SOCKET_ACCESS_CONTROL_LOCALHOST, "", 0)
except dbus.DBusException, e:
assert e.get_dbus_name() == cs.NOT_AVAILABLE
else:
assert False
self.close_channel()
# stop the test
return True
class SendFileAndDisconnect (SendFileTest):
def __init__(self, file, address_type,
access_control, acces_control_param):
FileTransferTest.__init__(self, file, address_type,
access_control, acces_control_param)
self._actions = [self.connect, self.set_ft_caps,
self.check_ft_available, None,
self.wait_for_ft_caps, None,
self.request_ft_channel, self.provide_file,
self.disconnect, None,
self.close_channel, self.done]
def disconnect(self):
self.conn.Disconnect()
if __name__ == '__main__':
exec_file_transfer_test(SendFileAndDisconnect, \
ReceiveFileAndSenderDisconnectWhilePendingTest)
|