[CalendarServer-changes] [2283]
CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.test.
test_xml.patch
source_changes at macosforge.org
source_changes at macosforge.org
Thu Apr 3 16:32:10 PDT 2008
Revision: 2283
http://trac.macosforge.org/projects/calendarserver/changeset/2283
Author: wsanchez at apple.com
Date: 2008-04-03 16:32:10 -0700 (Thu, 03 Apr 2008)
Log Message:
-----------
Add tests for XML
Added Paths:
-----------
CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.test.test_xml.patch
Added: CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.test.test_xml.patch
===================================================================
--- CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.test.test_xml.patch (rev 0)
+++ CalendarServer/trunk/lib-patches/Twisted/twisted.web2.dav.test.test_xml.patch 2008-04-03 23:32:10 UTC (rev 2283)
@@ -0,0 +1,88 @@
+Index: twisted/web2/dav/test/test_xml.py
+===================================================================
+--- twisted/web2/dav/test/test_xml.py (revision 0)
++++ twisted/web2/dav/test/test_xml.py (revision 0)
+@@ -0,0 +1,83 @@
++##
++# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
++#
++# Permission is hereby granted, free of charge, to any person obtaining a copy
++# of this software and associated documentation files (the "Software"), to deal
++# in the Software without restriction, including without limitation the rights
++# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
++# copies of the Software, and to permit persons to whom the Software is
++# furnished to do so, subject to the following conditions:
++#
++# The above copyright notice and this permission notice shall be included in all
++# copies or substantial portions of the Software.
++#
++# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
++# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
++# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
++# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
++# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
++# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
++# SOFTWARE.
++##
++
++from twisted.trial import unittest
++from twisted.web2.dav import davxml
++
++class XML(unittest.TestCase):
++ """
++ XML tests.
++ """
++ def test_parse(self):
++ """
++ Simple parsing
++ """
++ doc = davxml.WebDAVDocument.fromString(
++ """<?xml version="1.0" encoding="utf-8" ?>"""
++ """<D:multistatus xmlns:D="DAV:">"""
++ """ <D:response>"""
++ """ <D:href>http://webdav.sb.aol.com/webdav/secret</D:href>"""
++ """ <D:status>HTTP/1.1 403 Forbidden</D:status>"""
++ """ </D:response>"""
++ """</D:multistatus>"""
++ )
++ self.assertEquals(
++ doc,
++ davxml.WebDAVDocument(
++ davxml.MultiStatus(
++ davxml.Response(
++ davxml.HRef("http://webdav.sb.aol.com/webdav/secret"),
++ davxml.Status("HTTP/1.1 403 Forbidden"),
++ )
++ )
++ )
++ )
++
++ def test_serialize_unserialize(self):
++ """
++ Serialization and unserialization results in equivalent document.
++ """
++ doc = davxml.WebDAVDocument(
++ davxml.MultiStatus(
++ davxml.Response(
++ davxml.HRef("http://webdav.sb.aol.com/webdav/secret"),
++ davxml.Status("HTTP/1.1 403 Forbidden"),
++ )
++ )
++ )
++ self.assertEquals(doc, davxml.WebDAVDocument.fromString(doc.toxml()))
++
++ def test_unknownElement(self):
++ """
++ Serialization and unserialization of unknown element.
++ """
++ doc = davxml.WebDAVDocument.fromString(
++ """<?xml version="1.0" encoding="utf-8" ?>"""
++ """<T:foo xmlns:T="http://twistedmatrix.com/"/>"""
++ )
++
++ foo = davxml.WebDAVUnknownElement()
++ foo.namespace = "http://twistedmatrix.com/"
++ foo.name = "foo"
++
++ self.assertEquals(doc, davxml.WebDAVDocument(foo))
++ self.assertEquals(doc, davxml.WebDAVDocument.fromString(doc.toxml()))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20080403/0d72a8f0/attachment.html
More information about the calendarserver-changes
mailing list