merge of '8ba93fdae75ee545af159a1b88dfb6faccbe7bc2'
and 'f14da511e49cf36d5c6f6a7d9fe1aed0eeda1c79' Monotone-Parent: 8ba93fdae75ee545af159a1b88dfb6faccbe7bc2 Monotone-Parent: f14da511e49cf36d5c6f6a7d9fe1aed0eeda1c79 Monotone-Revision: a1e57050a74f60b51f4353a56736984146736973 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2009-08-06T21:22:45 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
commit
ee1e2a3f7d
|
@ -2,7 +2,15 @@ config.make
|
||||||
shared_debug_obj
|
shared_debug_obj
|
||||||
obj
|
obj
|
||||||
imgs-.*
|
imgs-.*
|
||||||
|
diff
|
||||||
|
.*\.bak$
|
||||||
|
.*\.diff$
|
||||||
.*\.d$
|
.*\.d$
|
||||||
|
.*\.log$
|
||||||
|
.*\.ifb$
|
||||||
|
.*\.ics
|
||||||
|
.*\.vcf$
|
||||||
|
.*\.old$
|
||||||
.*\.SOGo$
|
.*\.SOGo$
|
||||||
.*\.sax$
|
.*\.sax$
|
||||||
SoObjects/SOGo/SOGo.framework
|
SoObjects/SOGo/SOGo.framework
|
||||||
|
@ -11,3 +19,4 @@ SOPE/NGCards/samples/CardElement.m
|
||||||
SOPE/NGCards/samples/CardGroup.m
|
SOPE/NGCards/samples/CardGroup.m
|
||||||
SOPE/NGCards/samples/CardVersitRenderer.m
|
SOPE/NGCards/samples/CardVersitRenderer.m
|
||||||
SOPE/NGCards/samples/NGCardsSaxHandler.m
|
SOPE/NGCards/samples/NGCardsSaxHandler.m
|
||||||
|
Tests/testconfig.py
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
2009-08-06 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||||
|
|
||||||
|
* Tests/webdavlib.py (WebDAVClient._prepare_headers): we don't set
|
||||||
|
the "content-length" header if the body is None.
|
||||||
|
(HTTPSimpleQuery.render): method must take a "self" parameter.
|
||||||
|
(WebDAVCalendarMultiget.__init__): added transaction class.
|
||||||
|
|
||||||
2009-08-06 Francis Lachapelle <flachapelle@inverse.ca>
|
2009-08-06 Francis Lachapelle <flachapelle@inverse.ca>
|
||||||
|
|
||||||
* UI/PreferencesUI/UIxPreferences.m ([UIxPreferences
|
* UI/PreferencesUI/UIxPreferences.m ([UIxPreferences
|
||||||
|
|
35
Tests/README
35
Tests/README
|
@ -12,8 +12,39 @@ runnable scripts
|
||||||
|
|
||||||
webdav-sync.py
|
webdav-sync.py
|
||||||
|
|
||||||
other
|
other scripts
|
||||||
-----
|
-------------
|
||||||
|
|
||||||
propfind.py - a sample implementation of a PROPFIND request using webdavlib
|
propfind.py - a sample implementation of a PROPFIND request using webdavlib
|
||||||
|
|
||||||
|
* developers
|
||||||
|
------------
|
||||||
|
|
||||||
|
- Test methods are always prefixed with "test". Sometimes, it's easier to
|
||||||
|
track down a problem by enabling only one test at a time. One possible method
|
||||||
|
is to replace "def test" with "def xtest" and replace it back when the
|
||||||
|
problems are solved.
|
||||||
|
|
||||||
|
- Test failures start with "FAIL:". Those are the ones that indicate possible
|
||||||
|
bugs in the application, if the test is well written.
|
||||||
|
For example like this:
|
||||||
|
|
||||||
|
======================================================================
|
||||||
|
FAIL: 'modify' PUBLIC, 'view all' PRIVATE, 'view d&t' confidential
|
||||||
|
----------------------------------------------------------------------
|
||||||
|
Traceback (most recent call last):
|
||||||
|
File "./davacl.py", line 75, in testModifyPublicViewAllPrivateViewDConfidential
|
||||||
|
self._testRights({ "pu": "m", "pr": "v", "co": "d" })
|
||||||
|
File "./davacl.py", line 119, in _testRights
|
||||||
|
self._testCreate(rights)
|
||||||
|
File "./davacl.py", line 165, in _testCreate
|
||||||
|
exp_code)
|
||||||
|
File "./davacl.py", line 107, in _putEvent
|
||||||
|
% (exp_status, put.response["status"]))
|
||||||
|
AssertionError: event creation/modification: expected status code '403' (received '201')
|
||||||
|
|
||||||
|
- Test errors start with "ERRORS" and most likely indicate a bug in the test
|
||||||
|
code itself.
|
||||||
|
|
||||||
|
- Always set a doc string on the test methods, especially for complex test
|
||||||
|
cases
|
||||||
|
|
|
@ -18,8 +18,9 @@ class WebDAVClient:
|
||||||
|
|
||||||
def _prepare_headers(self, query, body):
|
def _prepare_headers(self, query, body):
|
||||||
headers = { "User-Agent": "Mozilla/5.0",
|
headers = { "User-Agent": "Mozilla/5.0",
|
||||||
"content-length": len(body),
|
|
||||||
"authorization": "Basic %s" % self.simpleauth_hash }
|
"authorization": "Basic %s" % self.simpleauth_hash }
|
||||||
|
if body is not None:
|
||||||
|
headers["content-length"] = len(body)
|
||||||
if query.__dict__.has_key("query") and query.depth is not None:
|
if query.__dict__.has_key("query") and query.depth is not None:
|
||||||
headers["depth"] = query.depth
|
headers["depth"] = query.depth
|
||||||
if query.__dict__.has_key("content_type"):
|
if query.__dict__.has_key("content_type"):
|
||||||
|
@ -45,17 +46,9 @@ class HTTPSimpleQuery:
|
||||||
self.start = -1
|
self.start = -1
|
||||||
self.duration = -1
|
self.duration = -1
|
||||||
|
|
||||||
def render():
|
def render(self):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
class HTTPGET(HTTPSimpleQuery):
|
|
||||||
method = "GET"
|
|
||||||
|
|
||||||
class HTTPQuery(HTTPSimpleQuery):
|
|
||||||
def __init__(self, url, content_type):
|
|
||||||
HTTPSimpleQuery.__init__(self, url)
|
|
||||||
self.content_type = content_type
|
|
||||||
|
|
||||||
def set_response(self, http_response):
|
def set_response(self, http_response):
|
||||||
headers = {}
|
headers = {}
|
||||||
for rk, rv in http_response.getheaders():
|
for rk, rv in http_response.getheaders():
|
||||||
|
@ -66,6 +59,14 @@ class HTTPQuery(HTTPSimpleQuery):
|
||||||
"version": http_response.version,
|
"version": http_response.version,
|
||||||
"body": http_response.read() }
|
"body": http_response.read() }
|
||||||
|
|
||||||
|
class HTTPGET(HTTPSimpleQuery):
|
||||||
|
method = "GET"
|
||||||
|
|
||||||
|
class HTTPQuery(HTTPSimpleQuery):
|
||||||
|
def __init__(self, url, content_type):
|
||||||
|
HTTPSimpleQuery.__init__(self, url)
|
||||||
|
self.content_type = content_type
|
||||||
|
|
||||||
class HTTPPUT(HTTPQuery):
|
class HTTPPUT(HTTPQuery):
|
||||||
method = "PUT"
|
method = "PUT"
|
||||||
|
|
||||||
|
@ -76,6 +77,9 @@ class HTTPPUT(HTTPQuery):
|
||||||
def render(self):
|
def render(self):
|
||||||
return self.content
|
return self.content
|
||||||
|
|
||||||
|
class HTTPPOST(HTTPPUT):
|
||||||
|
method = "POST"
|
||||||
|
|
||||||
class WebDAVQuery(HTTPQuery):
|
class WebDAVQuery(HTTPQuery):
|
||||||
method = None
|
method = None
|
||||||
|
|
||||||
|
@ -138,6 +142,22 @@ class WebDAVPROPFIND(WebDAVQuery):
|
||||||
prop_tag = self.render_tag(prop)
|
prop_tag = self.render_tag(prop)
|
||||||
props.append(_WD_XMLTreeElement(prop_tag))
|
props.append(_WD_XMLTreeElement(prop_tag))
|
||||||
|
|
||||||
|
class WebDAVCalendarMultiget(WebDAVREPORT):
|
||||||
|
def __init__(self, url, properties, hrefs):
|
||||||
|
WebDAVQuery.__init__(self, url)
|
||||||
|
multiget_tag = self.ns_mgr.register("calendar-multiget", "urn:ietf:params:xml:ns:caldav")
|
||||||
|
self.top_node = _WD_XMLTreeElement(multiget_tag)
|
||||||
|
props = _WD_XMLTreeElement("prop")
|
||||||
|
self.top_node.append(props)
|
||||||
|
for prop in properties:
|
||||||
|
prop_tag = self.render_tag(prop)
|
||||||
|
props.append(_WD_XMLTreeElement(prop_tag))
|
||||||
|
|
||||||
|
for href in hrefs:
|
||||||
|
href_node = _WD_XMLTreeElement("href")
|
||||||
|
self.top_node.append(href_node)
|
||||||
|
href_node.append(_WD_XMLTreeTextNode(href))
|
||||||
|
|
||||||
class WebDAVSyncQuery(WebDAVREPORT):
|
class WebDAVSyncQuery(WebDAVREPORT):
|
||||||
def __init__(self, url, token, properties):
|
def __init__(self, url, token, properties):
|
||||||
WebDAVQuery.__init__(self, url)
|
WebDAVQuery.__init__(self, url)
|
||||||
|
@ -204,11 +224,10 @@ class _WD_XMLTreeElement:
|
||||||
if ns_text is not None:
|
if ns_text is not None:
|
||||||
text = text + ns_text
|
text = text + ns_text
|
||||||
|
|
||||||
count = len(self.children)
|
if len(self.children) > 0:
|
||||||
if count > 0:
|
|
||||||
text = text + ">"
|
text = text + ">"
|
||||||
for x in range(0, count):
|
for child in self.children:
|
||||||
text = text + self.children[x].render()
|
text = text + child.render()
|
||||||
text = text + "</" + self.tag + ">"
|
text = text + "</" + self.tag + ">"
|
||||||
else:
|
else:
|
||||||
text = text + "/>"
|
text = text + "/>"
|
||||||
|
|
|
@ -40,9 +40,9 @@ class WebdavSyncTest(unittest.TestCase):
|
||||||
# empty collection:
|
# empty collection:
|
||||||
# without a token (query1)
|
# without a token (query1)
|
||||||
# with a token (query2)
|
# with a token (query2)
|
||||||
# non-empty collection:
|
# (when done, non-empty collection:
|
||||||
# without a token (query3)
|
# without a token (query3)
|
||||||
# with a token (query4)
|
# with a token (query4))
|
||||||
|
|
||||||
query1 = webdavlib.WebDAVSyncQuery(resource, None, [ "getetag" ])
|
query1 = webdavlib.WebDAVSyncQuery(resource, None, [ "getetag" ])
|
||||||
self.client.execute(query1)
|
self.client.execute(query1)
|
Loading…
Reference in a new issue