summaryrefslogtreecommitdiff
path: root/addons/document_webdav/test_davclient.py
diff options
context:
space:
mode:
authorP. Christeas <p_christ@hol.gr>2010-11-03 13:25:35 +0200
committerP. Christeas <p_christ@hol.gr>2010-11-03 13:25:35 +0200
commit1c5c26a8afaed89d83fcaaa5aa6fb9a31d26a6c8 (patch)
tree088c6e9cf87fd261f35b186808855aff1b2a9e1e /addons/document_webdav/test_davclient.py
parent7f882e14cf2948a4fe4b2b2b34fa085e6dba4278 (diff)
doc webdav: move to the node_descriptor API
We need to support chunked transfers, as well as Ranges, so we should no longer use the node.get_data() but node.open_data('r'). bzr revid: p_christ@hol.gr-20101103112535-34sr4dhd3neunfv1
Diffstat (limited to 'addons/document_webdav/test_davclient.py')
-rw-r--r--addons/document_webdav/test_davclient.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/addons/document_webdav/test_davclient.py b/addons/document_webdav/test_davclient.py
index 35c870838ec..e5c3659d870 100644
--- a/addons/document_webdav/test_davclient.py
+++ b/addons/document_webdav/test_davclient.py
@@ -654,7 +654,9 @@ class DAVClient(object):
hdrs['Range'] = 'bytes='+ (','.join(rs))
s, m, d = self._http_request(self.davpath + path, method='GET', hdrs=hdrs)
assert s in (200, 206), "Bad status: %s" % s
- ctype = m.getheader('Content-Type').split(';',1)[0]
+ ctype = m.getheader('Content-Type')
+ if ctype and ';' in ctype:
+ ctype = ctype.split(';',1)[0]
if mime:
assert ctype == mime, m.getheader('Content-Type')
rrange = None
@@ -668,6 +670,11 @@ class DAVClient(object):
fd = open(compare, 'rb')
d2 = fd.read()
fd.close()
+ if crange:
+ if len(crange) > 1:
+ raise NotImplementedError
+ r = crange[0]
+ d2 = d2[r[0]:r[1]+1]
assert d2 == d, "Data does not match"
return ctype, rrange, d