[CalendarServer-changes] [7202] CalDAVTester/trunk/verifiers/calendarDataMatch.py
source_changes at macosforge.org
source_changes at macosforge.org
Wed Mar 16 18:06:33 PDT 2011
Revision: 7202
http://trac.macosforge.org/projects/calendarserver/changeset/7202
Author: cdaboo at apple.com
Date: 2011-03-16 18:06:33 -0700 (Wed, 16 Mar 2011)
Log Message:
-----------
Allow data to be provided as a string as an alternative to a file.
Modified Paths:
--------------
CalDAVTester/trunk/verifiers/calendarDataMatch.py
Modified: CalDAVTester/trunk/verifiers/calendarDataMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/calendarDataMatch.py 2011-03-17 01:06:04 UTC (rev 7201)
+++ CalDAVTester/trunk/verifiers/calendarDataMatch.py 2011-03-17 01:06:33 UTC (rev 7202)
@@ -29,6 +29,7 @@
def verify(self, manager, uri, response, respdata, args): #@UnusedVariable
# Get arguments
files = args.get("filepath", [])
+ caldata = args.get("data", [])
filters = args.get("filter", [])
if "EMAIL parameter" not in manager.server_info.features:
@@ -48,18 +49,21 @@
return False, " No response body"
# look for one file
- if len(files) != 1:
+ if len(files) != 1 and len(caldata) != 1:
return False, " No file to compare response to"
- # read in all data from specified file
- fd = open( files[0], "r" )
- try:
+ # read in all data from specified file or use provided data
+ if len(files):
+ fd = open( files[0], "r" )
try:
- data = fd.read()
- finally:
- fd.close()
- except:
- data = None
+ try:
+ data = fd.read()
+ finally:
+ fd.close()
+ except:
+ data = None
+ else:
+ data = caldata[0] if len(caldata) else None
if data is None:
return False, " Could not read data file"
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110316/e6754f4e/attachment.html>
More information about the calendarserver-changes
mailing list