[Telepathy-commits] [telepathy-salut/master] file_transfer_helper.py: factor out _get_http_response
Guillaume Desmottes
guillaume.desmottes at collabora.co.uk
Fri Dec 5 05:51:54 PST 2008
---
tests/twisted/avahi/file_transfer_helper.py | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/tests/twisted/avahi/file_transfer_helper.py b/tests/twisted/avahi/file_transfer_helper.py
index 1ac2395..679e901 100644
--- a/tests/twisted/avahi/file_transfer_helper.py
+++ b/tests/twisted/avahi/file_transfer_helper.py
@@ -383,6 +383,13 @@ class SendFileTest(FileTransferTest):
self.http = httplib.HTTPConnection(self.host)
self.http.request('GET', self.filename)
+ def _get_http_response(self):
+ response = self.http.getresponse()
+ assert (response.status, response.reason) == (200, 'OK')
+ data = response.read(self.file.size)
+ # Did we received the right file?
+ assert data == self.file.data
+
def send_file(self):
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(self.address)
@@ -396,11 +403,7 @@ class SendFileTest(FileTransferTest):
e = self.q.expect('dbus-signal', signal='TransferredBytesChanged')
count = e.args[0]
- response = self.http.getresponse()
- assert (response.status, response.reason) == (200, 'OK')
- data = response.read(self.file.size)
- # Did we received the right file?
- assert data == self.file.data
+ self._get_http_response()
# Inform sender that we received all the file from the OOB transfer
reply = domish.Element(('', 'iq'))
--
1.5.6.5
More information about the Telepathy-commits
mailing list