[CalendarServer-changes] [14711] CalDAVTester/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Mon Apr 27 08:10:43 PDT 2015
Revision: 14711
http://trac.calendarserver.org//changeset/14711
Author: cdaboo at apple.com
Date: 2015-04-27 08:10:42 -0700 (Mon, 27 Apr 2015)
Log Message:
-----------
Make sure pseudo-requests use the right host/port for from the original request. Clean-up properly after a sharing test.
Modified Paths:
--------------
CalDAVTester/trunk/scripts/tests-pod/CalDAV/sharing-reports-query.xml
CalDAVTester/trunk/src/caldavtest.py
Modified: CalDAVTester/trunk/scripts/tests-pod/CalDAV/sharing-reports-query.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests-pod/CalDAV/sharing-reports-query.xml 2015-04-24 20:56:47 UTC (rev 14710)
+++ CalDAVTester/trunk/scripts/tests-pod/CalDAV/sharing-reports-query.xml 2015-04-27 15:10:42 UTC (rev 14711)
@@ -2984,6 +2984,15 @@
</test>
</test-suite>
- <end/>
+ <end>
+ <request user="$useradmin:" pswd="$pswdadmin:">
+ <method>DELETEALL</method>
+ <ruri>$notificationpath1:/</ruri>
+ </request>
+ <request host2="yes" user="$useradmin:" pswd="$pswdadmin:">
+ <method>DELETEALL</method>
+ <ruri>$pnotificationpath2:/</ruri>
+ </request>
+ </end>
</caldavtest>
Modified: CalDAVTester/trunk/src/caldavtest.py
===================================================================
--- CalDAVTester/trunk/src/caldavtest.py 2015-04-24 20:56:47 UTC (rev 14710)
+++ CalDAVTester/trunk/src/caldavtest.py 2015-04-27 15:10:42 UTC (rev 14711)
@@ -259,9 +259,11 @@
return result
- def doget(self, resource, label=""):
+ def doget(self, original_request, resource, label=""):
req = request(self.manager)
req.method = "GET"
+ req.host = original_request.host
+ req.port = original_request.port
req.ruris.append(resource[0])
req.ruri = resource[0]
if len(resource[1]):
@@ -275,10 +277,12 @@
return True, respdata
- def dofindall(self, collection, label=""):
+ def dofindall(self, original_request, collection, label=""):
hrefs = []
req = request(self.manager)
req.method = "PROPFIND"
+ req.host = original_request.host
+ req.port = original_request.port
req.ruris.append(collection[0])
req.ruri = collection[0]
req.headers["Depth"] = "1"
@@ -315,12 +319,14 @@
return hrefs
- def dodeleteall(self, deletes, label=""):
+ def dodeleteall(self, original_request, deletes, label=""):
if len(deletes) == 0:
return True
for deleter in deletes:
req = request(self.manager)
req.method = "DELETE"
+ req.host = original_request.host
+ req.port = original_request.port
req.ruris.append(deleter[0])
req.ruri = deleter[0]
if len(deleter[1]):
@@ -334,7 +340,7 @@
return True
- def dofindnew(self, collection, label="", other=False):
+ def dofindnew(self, original_request, collection, label="", other=False):
hresult = ""
uri = collection[0]
@@ -347,6 +353,8 @@
possible_matches = set()
req = request(self.manager)
req.method = "PROPFIND"
+ req.host = original_request.host
+ req.port = original_request.port
req.ruris.append(uri)
req.ruri = uri
req.headers["Depth"] = "1"
@@ -427,12 +435,14 @@
return hresult
- def dowaitcount(self, collection, count, label=""):
+ def dowaitcount(self, original_request, collection, count, label=""):
hrefs = []
for _ignore in range(self.manager.server_info.waitcount):
req = request(self.manager)
req.method = "PROPFIND"
+ req.host = original_request.host
+ req.port = original_request.port
req.ruris.append(collection[0])
req.ruri = collection[0]
req.headers["Depth"] = "1"
@@ -470,7 +480,7 @@
# Get the content of each resource
rdata = ""
for href in hrefs:
- result, respdata = self.doget((href, collection[1], collection[2],), label)
+ result, respdata = self.doget(req, (href, collection[1], collection[2],), label)
test = "unknown"
if respdata.startswith("BEGIN:VCALENDAR"):
uid = respdata.find("UID:")
@@ -484,11 +494,13 @@
return False, len(hrefs)
- def dowaitchanged(self, uri, etag, user, pswd, label=""):
+ def dowaitchanged(self, original_request, uri, etag, user, pswd, label=""):
for _ignore in range(self.manager.server_info.waitcount):
req = request(self.manager)
req.method = "HEAD"
+ req.host = original_request.host
+ req.port = original_request.port
req.ruris.append(uri)
req.ruri = uri
if user:
@@ -522,6 +534,8 @@
for deleter in self.end_deletes:
req = request(self.manager)
req.method = "DELETE"
+ req.host = deleter[3]
+ req.port = deleter[4]
req.ruris.append(deleter[0])
req.ruri = deleter[0]
if len(deleter[1]):
@@ -551,8 +565,8 @@
if req.method == "DELETEALL":
for ruri in req.ruris:
collection = (ruri, req.user, req.pswd)
- hrefs = self.dofindall(collection, label="%s | %s" % (label, "DELETEALL"))
- if not self.dodeleteall(hrefs, label="%s | %s" % (label, "DELETEALL")):
+ hrefs = self.dofindall(req, collection, label="%s | %s" % (label, "DELETEALL"))
+ if not self.dodeleteall(req, hrefs, label="%s | %s" % (label, "DELETEALL")):
return False, "DELETEALL failed for: {r}".format(r=ruri), None, None
return True, "", None, None
@@ -568,7 +582,7 @@
# Special for GETNEW
elif req.method == "GETNEW":
collection = (req.ruri, req.user, req.pswd)
- self.grabbedlocation = self.dofindnew(collection, label=label)
+ self.grabbedlocation = self.dofindnew(req, collection, label=label)
if req.graburi:
self.manager.server_info.addextrasubs({req.graburi: self.grabbedlocation})
req.method = "GET"
@@ -577,7 +591,7 @@
# Special for FINDNEW
elif req.method == "FINDNEW":
collection = (req.ruri, req.user, req.pswd)
- self.grabbedlocation = self.dofindnew(collection, label=label)
+ self.grabbedlocation = self.dofindnew(req, collection, label=label)
if req.graburi:
self.manager.server_info.addextrasubs({req.graburi: self.grabbedlocation})
return True, "", None, None
@@ -585,7 +599,7 @@
# Special for GETOTHER
elif req.method == "GETOTHER":
collection = (req.ruri, req.user, req.pswd)
- self.grabbedlocation = self.dofindnew(collection, label=label, other=True)
+ self.grabbedlocation = self.dofindnew(req, collection, label=label, other=True)
if req.graburi:
self.manager.server_info.addextrasubs({req.graburi: self.grabbedlocation})
req.method = "GET"
@@ -596,7 +610,7 @@
count = int(req.method[10:])
for ruri in req.ruris:
collection = (ruri, req.user, req.pswd)
- waitresult, waitdetails = self.dowaitcount(collection, count, label=label)
+ waitresult, waitdetails = self.dowaitcount(req, collection, count, label=label)
if not waitresult:
return False, "Count did not change: {w}".format(w=waitdetails), None, None
else:
@@ -607,10 +621,10 @@
count = int(req.method[len("WAITDELETEALL"):])
for ruri in req.ruris:
collection = (ruri, req.user, req.pswd)
- waitresult, waitdetails = self.dowaitcount(collection, count, label=label)
+ waitresult, waitdetails = self.dowaitcount(req, collection, count, label=label)
if waitresult:
- hrefs = self.dofindall(collection, label="%s | %s" % (label, "DELETEALL"))
- self.dodeleteall(hrefs, label="%s | %s" % (label, "DELETEALL"))
+ hrefs = self.dofindall(req, collection, label="%s | %s" % (label, "DELETEALL"))
+ self.dodeleteall(req, hrefs, label="%s | %s" % (label, "DELETEALL"))
else:
return False, "Count did not change: {w}".format(w=waitdetails), None, None
else:
@@ -630,7 +644,7 @@
# Cache delayed delete
if req.end_delete:
- self.end_deletes.append((uri, req.user, req.pswd))
+ self.end_deletes.append((uri, req.user, req.pswd, req.host, req.port,))
if details:
resulttxt += " %s: %s\n" % (method, uri)
@@ -638,6 +652,7 @@
# Special for GETCHANGED
if req.method == "GETCHANGED":
if not self.dowaitchanged(
+ req,
uri, etags[uri], req.user, req.pswd,
label=label
):
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20150427/d403ca8c/attachment-0001.html>
More information about the calendarserver-changes
mailing list