[telepathy-gabble/master] pass file args to FT tests so we can easily test resume
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Apr 17 06:37:04 PDT 2009
---
.../twisted/file-transfer/file_transfer_helper.py | 21 +++++++++++++------
.../test-send-file-to-unknown-contact.py | 4 +-
.../test-send-file-wait-to-provide.py | 4 +-
3 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/tests/twisted/file-transfer/file_transfer_helper.py b/tests/twisted/file-transfer/file_transfer_helper.py
index e58b335..0226077 100644
--- a/tests/twisted/file-transfer/file_transfer_helper.py
+++ b/tests/twisted/file-transfer/file_transfer_helper.py
@@ -47,8 +47,8 @@ class File(object):
class FileTransferTest(object):
CONTACT_NAME = 'test-ft at localhost'
- def __init__(self, bytestream_cls, address_type, access_control, access_control_param):
- self.file = File()
+ def __init__(self, bytestream_cls, file, address_type, access_control, access_control_param):
+ self.file = file
self.bytestream_cls = bytestream_cls
self.address_type = address_type
self.access_control = access_control
@@ -144,8 +144,8 @@ class FileTransferTest(object):
assert False
class ReceiveFileTest(FileTransferTest):
- def __init__(self, bytestream_cls, address_type, access_control, access_control_param):
- FileTransferTest.__init__(self, bytestream_cls, address_type, access_control, access_control_param)
+ def __init__(self, bytestream_cls, file, address_type, access_control, access_control_param):
+ FileTransferTest.__init__(self, bytestream_cls, file, address_type, access_control, access_control_param)
self._actions = [self.connect, self.announce_contact,
self.send_ft_offer_iq, self.check_new_channel, self.create_ft_channel, self.accept_file,
@@ -279,8 +279,8 @@ class ReceiveFileTest(FileTransferTest):
assert reason == cs.FT_STATE_CHANGE_REASON_NONE
class SendFileTest(FileTransferTest):
- def __init__(self, bytestream_cls, address_type, access_control, acces_control_param):
- FileTransferTest.__init__(self, bytestream_cls, address_type, access_control, acces_control_param)
+ def __init__(self, bytestream_cls, file, address_type, access_control, acces_control_param):
+ FileTransferTest.__init__(self, bytestream_cls, file, address_type, access_control, acces_control_param)
self._actions = [self.connect, self.announce_contact,
self.check_ft_available, self.request_ft_channel, self.create_ft_channel,
@@ -437,5 +437,12 @@ def exec_file_transfer_test(test_cls):
(cs.SOCKET_ADDRESS_TYPE_UNIX, cs.SOCKET_ACCESS_CONTROL_LOCALHOST, ""),
(cs.SOCKET_ADDRESS_TYPE_IPV4, cs.SOCKET_ACCESS_CONTROL_LOCALHOST, ""),
(cs.SOCKET_ADDRESS_TYPE_IPV6, cs.SOCKET_ACCESS_CONTROL_LOCALHOST, "")]:
- test = test_cls(bytestream_cls, addr_type, access_control, access_control_param)
+
+ file = File()
+ test = test_cls(bytestream_cls, file, addr_type, access_control, access_control_param)
+ exec_test(test.test)
+
+ # test resume
+ file.offset = 5
+ test = test_cls(bytestream_cls, file, addr_type, access_control, access_control_param)
exec_test(test.test)
diff --git a/tests/twisted/file-transfer/test-send-file-to-unknown-contact.py b/tests/twisted/file-transfer/test-send-file-to-unknown-contact.py
index 4d06fae..5acb58c 100644
--- a/tests/twisted/file-transfer/test-send-file-to-unknown-contact.py
+++ b/tests/twisted/file-transfer/test-send-file-to-unknown-contact.py
@@ -4,8 +4,8 @@ import constants as cs
from file_transfer_helper import SendFileTest, exec_file_transfer_test
class SendFileTransferToUnknownContactTest(SendFileTest):
- def __init__(self, bytestream_cls, address_type, access_control, acces_control_param):
- SendFileTest.__init__(self, bytestream_cls, address_type, access_control, acces_control_param)
+ def __init__(self, bytestream_cls, file, address_type, access_control, acces_control_param):
+ SendFileTest.__init__(self, bytestream_cls, file, address_type, access_control, acces_control_param)
self._actions = [self.connect, self.check_ft_available, self.my_request_ft_channel]
diff --git a/tests/twisted/file-transfer/test-send-file-wait-to-provide.py b/tests/twisted/file-transfer/test-send-file-wait-to-provide.py
index e4aa8b6..55334fa 100644
--- a/tests/twisted/file-transfer/test-send-file-wait-to-provide.py
+++ b/tests/twisted/file-transfer/test-send-file-wait-to-provide.py
@@ -2,8 +2,8 @@ import constants as cs
from file_transfer_helper import SendFileTest, exec_file_transfer_test
class SendFileTransferWaitToProvideTest(SendFileTest):
- def __init__(self, bytestream_cls, address_type, access_control, acces_control_param):
- SendFileTest.__init__(self, bytestream_cls, address_type, access_control, acces_control_param)
+ def __init__(self, bytestream_cls, file, address_type, access_control, acces_control_param):
+ SendFileTest.__init__(self, bytestream_cls, file, address_type, access_control, acces_control_param)
self._actions = [self.connect, self.check_ft_available, self.announce_contact,
self.check_ft_available, self.request_ft_channel, self.create_ft_channel, self.got_send_iq,
--
1.5.6.5
More information about the telepathy-commits
mailing list