[CalendarServer-changes] [13914] CalDAVTester/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Aug 22 11:13:07 PDT 2014
Revision: 13914
http://trac.calendarserver.org//changeset/13914
Author: cdaboo at apple.com
Date: 2014-08-22 11:13:07 -0700 (Fri, 22 Aug 2014)
Log Message:
-----------
Better handling of calendar/contact data comparisons. Minor script file clean-ups.
Modified Paths:
--------------
CalDAVTester/trunk/scripts/tests/CardDAV/caldavtest.dtd
CalDAVTester/trunk/scripts/tests/CardDAV/put.xml
CalDAVTester/trunk/scripts/tests/CardDAV/sharing-bulk.xml
CalDAVTester/trunk/verifiers/addressDataMatch.py
CalDAVTester/trunk/verifiers/calendarDataMatch.py
Added Paths:
-----------
CalDAVTester/trunk/verifiers/jcardDataMatch.py
Modified: CalDAVTester/trunk/scripts/tests/CardDAV/caldavtest.dtd
===================================================================
--- CalDAVTester/trunk/scripts/tests/CardDAV/caldavtest.dtd 2014-08-22 18:00:16 UTC (rev 13913)
+++ CalDAVTester/trunk/scripts/tests/CardDAV/caldavtest.dtd 2014-08-22 18:13:07 UTC (rev 13914)
@@ -74,7 +74,8 @@
<!ELEMENT test-suite (require-feature?, exclude-feature?, test*)>
<!ATTLIST test-suite name CDATA #REQUIRED
ignore (yes|no) "no"
- only (yes|no) "no">
+ only (yes|no) "no"
+ change-uid (yes|no) "no">
<!ELEMENT test (require-feature?, exclude-feature?, description?, (request|pause)+)>
<!ATTLIST test name CDATA #REQUIRED
Modified: CalDAVTester/trunk/scripts/tests/CardDAV/put.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/CardDAV/put.xml 2014-08-22 18:00:16 UTC (rev 13913)
+++ CalDAVTester/trunk/scripts/tests/CardDAV/put.xml 2014-08-22 18:13:07 UTC (rev 13914)
@@ -26,7 +26,6 @@
</require-feature>
<start>
- <description>clean up old data</description>
<request user="$useradmin:" pswd="$pswdadmin:">
<method>DELETEALL</method>
<ruri>$addressbookhome1:/</ruri>
@@ -591,7 +590,6 @@
</test-suite>
<end>
- <description>clean up old data</description>
<request user="$useradmin:" pswd="$pswdadmin:">
<method>DELETEALL</method>
<ruri>$addressbookhome1:/</ruri>
Modified: CalDAVTester/trunk/scripts/tests/CardDAV/sharing-bulk.xml
===================================================================
--- CalDAVTester/trunk/scripts/tests/CardDAV/sharing-bulk.xml 2014-08-22 18:00:16 UTC (rev 13913)
+++ CalDAVTester/trunk/scripts/tests/CardDAV/sharing-bulk.xml 2014-08-22 18:13:07 UTC (rev 13914)
@@ -33,7 +33,7 @@
<test-suite name='POST with circular groups'>
<test name='0'>
- <description>clean up old data</description>
+ <!-- clean up old data -->
<request user="$useradmin:" pswd="$pswdadmin:">
<method>DELETEALL</method>
<ruri>$addressbookhome1:/</ruri>
@@ -49,7 +49,7 @@
<filepath>Resource/CardDAV/sharing/bulk/1.vcf</filepath>
</data>
</request>
- <description>user2 POSTs invitation</description>
+ <!-- user2 POSTs invitation -->
<request user="$userid2:" pswd="$pswd2:">
<method>POST</method>
<ruri>$addressbookpath2:/1.vcf</ruri>
@@ -58,7 +58,7 @@
<filepath>Resource/CardDAV/sharing/bulk/9.xml</filepath>
</data>
</request>
- <description>Check user1 notification collection and get invite uid</description>
+ <!-- Check user1 notification collection and get invite uid -->
<request>
<method>WAITCOUNT 1</method>
<ruri>$notificationpath1:/</ruri>
@@ -71,7 +71,7 @@
<variable>$inviteuid:</variable>
</grabelement>
</request>
- <description>user1 replies ACCEPTED and deletes notification</description>
+ <!-- user1 replies ACCEPTED and deletes notification -->
<request>
<method>POST</method>
<ruri>$addressbookhome1:/</ruri>
@@ -238,7 +238,7 @@
<test-suite name='POST with circular groups and one bad reference'>
<test name='0'>
- <description>clean up old data</description>
+ <!-- clean up old data -->
<request user="$useradmin:" pswd="$pswdadmin:">
<method>DELETEALL</method>
<ruri>$addressbookhome1:/</ruri>
@@ -254,7 +254,7 @@
<filepath>Resource/CardDAV/sharing/bulk/1.vcf</filepath>
</data>
</request>
- <description>user2 POSTs invitation</description>
+ <!-- user2 POSTs invitation -->
<request user="$userid2:" pswd="$pswd2:">
<method>POST</method>
<ruri>$addressbookpath2:/1.vcf</ruri>
@@ -263,7 +263,7 @@
<filepath>Resource/CardDAV/sharing/bulk/9.xml</filepath>
</data>
</request>
- <description>Check user1 notification collection and get invite uid</description>
+ <!-- Check user1 notification collection and get invite uid -->
<request>
<method>WAITCOUNT 1</method>
<ruri>$notificationpath1:/</ruri>
@@ -276,7 +276,7 @@
<variable>$inviteuid:</variable>
</grabelement>
</request>
- <description>user1 replies ACCEPTED and deletes notification</description>
+ <!-- user1 replies ACCEPTED and deletes notification -->
<request>
<method>POST</method>
<ruri>$addressbookhome1:/</ruri>
@@ -429,7 +429,7 @@
<test-suite name='CRUD POST with circular groups'>
<test name='0'>
- <description>clean up old data</description>
+ <!-- clean up old data -->
<request user="$useradmin:" pswd="$pswdadmin:">
<method>DELETEALL</method>
<ruri>$addressbookhome1:/</ruri>
@@ -445,7 +445,7 @@
<filepath>Resource/CardDAV/sharing/bulk/1.vcf</filepath>
</data>
</request>
- <description>user2 POSTs invitation</description>
+ <!-- user2 POSTs invitation -->
<request user="$userid2:" pswd="$pswd2:">
<method>POST</method>
<ruri>$addressbookpath2:/1.vcf</ruri>
@@ -454,7 +454,7 @@
<filepath>Resource/CardDAV/sharing/bulk/9.xml</filepath>
</data>
</request>
- <description>Check user1 notification collection and get invite uid</description>
+ <!-- Check user1 notification collection and get invite uid -->
<request>
<method>WAITCOUNT 1</method>
<ruri>$notificationpath1:/</ruri>
@@ -467,7 +467,7 @@
<variable>$inviteuid:</variable>
</grabelement>
</request>
- <description>user1 replies ACCEPTED and deletes notification</description>
+ <!-- user1 replies ACCEPTED and deletes notification -->
<request>
<method>POST</method>
<ruri>$addressbookhome1:/</ruri>
@@ -620,7 +620,7 @@
<test-suite name='crud POST with circular groups and one bad reference'>
<test name='0'>
- <description>clean up old data</description>
+ <!-- clean up old data -->
<request user="$useradmin:" pswd="$pswdadmin:">
<method>DELETEALL</method>
<ruri>$addressbookhome1:/</ruri>
@@ -636,7 +636,7 @@
<filepath>Resource/CardDAV/sharing/bulk/1.vcf</filepath>
</data>
</request>
- <description>user2 POSTs invitation</description>
+ <!-- user2 POSTs invitation -->
<request user="$userid2:" pswd="$pswd2:">
<method>POST</method>
<ruri>$addressbookpath2:/1.vcf</ruri>
@@ -645,7 +645,7 @@
<filepath>Resource/CardDAV/sharing/bulk/9.xml</filepath>
</data>
</request>
- <description>Check user1 notification collection and get invite uid</description>
+ <!-- Check user1 notification collection and get invite uid -->
<request>
<method>WAITCOUNT 1</method>
<ruri>$notificationpath1:/</ruri>
@@ -658,7 +658,7 @@
<variable>$inviteuid:</variable>
</grabelement>
</request>
- <description>user1 replies ACCEPTED and deletes notification</description>
+ <!-- user1 replies ACCEPTED and deletes notification -->
<request>
<method>POST</method>
<ruri>$addressbookhome1:/</ruri>
@@ -789,7 +789,7 @@
<test-suite name='crud POST delete cannot delete (unshare) read-write shared group'>
<test name='0'>
- <description>clean up old data</description>
+ <!-- clean up old data -->
<request user="$useradmin:" pswd="$pswdadmin:">
<method>DELETEALL</method>
<ruri>$addressbookhome1:/</ruri>
@@ -805,7 +805,7 @@
<filepath>Resource/CardDAV/sharing/bulk/1.vcf</filepath>
</data>
</request>
- <description>user2 POSTs invitation</description>
+ <!-- user2 POSTs invitation -->
<request user="$userid2:" pswd="$pswd2:">
<method>POST</method>
<ruri>$addressbookpath2:/1.vcf</ruri>
@@ -814,7 +814,7 @@
<filepath>Resource/CardDAV/sharing/bulk/9.xml</filepath>
</data>
</request>
- <description>Check user1 notification collection and get invite uid</description>
+ <!-- Check user1 notification collection and get invite uid -->
<request>
<method>WAITCOUNT 1</method>
<ruri>$notificationpath1:/</ruri>
@@ -827,7 +827,7 @@
<variable>$inviteuid:</variable>
</grabelement>
</request>
- <description>user1 replies ACCEPTED and deletes notification</description>
+ <!-- user1 replies ACCEPTED and deletes notification -->
<request>
<method>POST</method>
<ruri>$addressbookhome1:/</ruri>
@@ -921,7 +921,6 @@
</test-suite>
<end>
- <description>clean up old data</description>
<request user="$useradmin:" pswd="$pswdadmin:">
<method>DELETEALL</method>
<ruri>$addressbookhome1:/</ruri>
Modified: CalDAVTester/trunk/verifiers/addressDataMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/addressDataMatch.py 2014-08-22 18:00:16 UTC (rev 13913)
+++ CalDAVTester/trunk/verifiers/addressDataMatch.py 2014-08-22 18:13:07 UTC (rev 13914)
@@ -23,7 +23,7 @@
class Verifier(object):
- def verify(self, manager, uri, response, respdata, args): #@UnusedVariable
+ def verify(self, manager, uri, response, respdata, args, is_json=False): #@UnusedVariable
# Get arguments
files = args.get("filepath", [])
carddata = args.get("data", [])
@@ -80,15 +80,17 @@
component.removeProperty(property)
try:
- resp_adbk = Card.parseText(respdata)
+ format = Card.sFormatJSON if is_json else Card.sFormatText
+
+ resp_adbk = Card.parseData(respdata, format=format)
removePropertiesParameters(resp_adbk)
- respdata = resp_adbk.getText()
+ respdata = resp_adbk.getText(format=format)
- data_adbk = Card.parseText(data)
+ data_adbk = Card.parseData(data, format=format)
removePropertiesParameters(data_adbk)
- data = data_adbk.getText()
+ data = data_adbk.getText(format=format)
- result = respdata == data
+ result = resp_adbk == data_adbk
if result:
return True, ""
Modified: CalDAVTester/trunk/verifiers/calendarDataMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/calendarDataMatch.py 2014-08-22 18:00:16 UTC (rev 13913)
+++ CalDAVTester/trunk/verifiers/calendarDataMatch.py 2014-08-22 18:13:07 UTC (rev 13914)
@@ -114,15 +114,17 @@
component.removeProperty(property)
try:
- resp_calendar = Calendar.parseText(respdata) if not is_json else Calendar.parseJSONData(respdata)
+ format = Calendar.sFormatJSON if is_json else Calendar.sFormatText
+
+ resp_calendar = Calendar.parseData(respdata, format=format)
removePropertiesParameters(resp_calendar)
- respdata = resp_calendar.getText(includeTimezones=Calendar.NO_TIMEZONES) if not is_json else resp_calendar.getTextJSON()
+ respdata = resp_calendar.getText(includeTimezones=Calendar.NO_TIMEZONES, format=format)
- data_calendar = Calendar.parseText(data) if not is_json else Calendar.parseJSONData(data)
+ data_calendar = Calendar.parseData(data, format=format)
removePropertiesParameters(data_calendar)
- data = data_calendar.getText(includeTimezones=Calendar.NO_TIMEZONES) if not is_json else data_calendar.getTextJSON()
+ data = data_calendar.getText(includeTimezones=Calendar.NO_TIMEZONES, format=format)
- result = respdata == data
+ result = resp_calendar == data_calendar
if result:
return True, ""
Added: CalDAVTester/trunk/verifiers/jcardDataMatch.py
===================================================================
--- CalDAVTester/trunk/verifiers/jcardDataMatch.py (rev 0)
+++ CalDAVTester/trunk/verifiers/jcardDataMatch.py 2014-08-22 18:13:07 UTC (rev 13914)
@@ -0,0 +1,30 @@
+##
+# Copyright (c) 2013 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+from verifiers.addressDataMatch import Verifier as CardVerifier
+
+"""
+Verifier that checks the response body for a semantic match to data in a file.
+"""
+
+class Verifier(object):
+
+ def verify(self, manager, uri, response, respdata, args):
+
+ # Just hand this off to the addressDataMatch verifier which knows all about
+ # proper vCard normalization rules.
+ verifier = CardVerifier()
+ return verifier.verify(manager, uri, response, respdata, args, is_json=True)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140822/af2cc660/attachment-0001.html>
More information about the calendarserver-changes
mailing list