[CalendarServer-changes] [8895] CalendarServer/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Mar 16 12:25:34 PDT 2012
Revision: 8895
http://trac.macosforge.org/projects/calendarserver/changeset/8895
Author: wsanchez at apple.com
Date: 2012-03-16 12:25:34 -0700 (Fri, 16 Mar 2012)
Log Message:
-----------
Move xml tests
Added Paths:
-----------
CalendarServer/trunk/txdav/xml/test/
CalendarServer/trunk/txdav/xml/test/__init__.py
CalendarServer/trunk/txdav/xml/test/test_xml.py
CalendarServer/trunk/txdav/xml/test/test_xml_rfc3744.py
Removed Paths:
-------------
CalendarServer/trunk/twext/web2/dav/test/test_xml.py
CalendarServer/trunk/twext/web2/dav/test/test_xml_rfc3744.py
Deleted: CalendarServer/trunk/twext/web2/dav/test/test_xml.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/test/test_xml.py 2012-03-16 18:34:32 UTC (rev 8894)
+++ CalendarServer/trunk/twext/web2/dav/test/test_xml.py 2012-03-16 19:25:34 UTC (rev 8895)
@@ -1,105 +0,0 @@
-# Copyright (c) 2009 Twisted Matrix Laboratories.
-# See LICENSE for details.
-
-##
-# 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.
-##
-
-"""
-Tests for L{twext.web2.dav.davxml}.
-"""
-
-from twisted.trial.unittest import TestCase
-from twext.web2.dav.davxml import WebDAVDocument, WebDAVUnknownElement
-from twext.web2.dav.davxml import Response, HRef, MultiStatus, Status
-from twext.web2.dav.davxml import CurrentUserPrincipal
-
-
-class WebDAVElementTestsMixin:
- """
- Mixin for L{TestCase}s which test a L{WebDAVElement} subclass.
- """
- def test_fromString(self):
- """
- The XML representation of L{WebDAVDocument} can be parsed into a
- L{WebDAVDocument} instance using L{WebDAVDocument.fromString}.
- """
- doc = WebDAVDocument.fromString(self.serialized)
- self.assertEquals(doc, WebDAVDocument(self.element))
-
-
- def test_toxml(self):
- """
- L{WebDAVDocument.toxml} returns a C{str} giving the XML representation
- of the L{WebDAVDocument} instance.
- """
- document = WebDAVDocument(self.element)
- self.assertEquals(
- document,
- WebDAVDocument.fromString(document.toxml()))
-
-
-
-class MultiStatusTests(WebDAVElementTestsMixin, TestCase):
- """
- Tests for L{MultiStatus}
- """
- serialized = (
- '<?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>')
-
- element = MultiStatus(
- Response(
- HRef("http://webdav.sb.aol.com/webdav/secret"),
- Status("HTTP/1.1 403 Forbidden")))
-
-
-
-class WebDAVUnknownElementTests(WebDAVElementTestsMixin, TestCase):
- """
- Tests for L{WebDAVUnknownElement}.
- """
- serialized = (
- '<?xml version="1.0" encoding="utf-8" ?>'
- '<T:foo xmlns:T="http://twistedmatrix.com/"/>')
-
- element = WebDAVUnknownElement()
- element.namespace = "http://twistedmatrix.com/"
- element.name = "foo"
-
-
-
-class CurrentUserPrincipalTests(WebDAVElementTestsMixin, TestCase):
- """
- Tests for L{CurrentUserPrincipal}.
- """
- serialized = (
- '<?xml version="1.0" encoding="utf-8" ?>'
- '<D:current-user-principal xmlns:D="DAV:">'
- ' <D:href>foo</D:href>'
- '</D:current-user-principal>')
-
- element = CurrentUserPrincipal(HRef("foo"))
Deleted: CalendarServer/trunk/twext/web2/dav/test/test_xml_rfc3744.py
===================================================================
--- CalendarServer/trunk/twext/web2/dav/test/test_xml_rfc3744.py 2012-03-16 18:34:32 UTC (rev 8894)
+++ CalendarServer/trunk/twext/web2/dav/test/test_xml_rfc3744.py 2012-03-16 19:25:34 UTC (rev 8895)
@@ -1,59 +0,0 @@
-##
-# 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.
-#
-# DRI: Wilfredo Sanchez, wsanchez at apple.com
-##
-
-from twisted.trial import unittest
-from twext.web2.dav import davxml
-from twext.web2.dav.resource import davPrivilegeSet
-
-class XML_3744(unittest.TestCase):
- """
- RFC 3744 (WebDAV ACL) XML tests.
- """
- def test_Privilege_isAggregateOf(self):
- """
- Privilege.isAggregateOf()
- """
- for a, b in (
- (davxml.All(), davxml.Write()),
- (davxml.All(), davxml.ReadACL()),
- (davxml.Write(), davxml.WriteProperties()),
- (davxml.Write(), davxml.WriteContent()),
- (davxml.Write(), davxml.Bind()),
- (davxml.Write(), davxml.Unbind()),
- ):
- pa = davxml.Privilege(a)
- pb = davxml.Privilege(b)
-
- self.failUnless(pa.isAggregateOf(pb, davPrivilegeSet), "%s contains %s" % (a.sname(), b.sname()))
- self.failIf(pb.isAggregateOf(pa, davPrivilegeSet), "%s does not contain %s" % (b.sname(), a.sname()))
-
- for a, b in (
- (davxml.Unlock(), davxml.Write()),
- (davxml.Unlock(), davxml.WriteACL()),
- (davxml.ReadCurrentUserPrivilegeSet(), davxml.WriteProperties()),
- ):
- pa = davxml.Privilege(a)
- pb = davxml.Privilege(b)
-
- self.failIf(pb.isAggregateOf(pa, davPrivilegeSet), "%s does not contain %s" % (b.sname(), a.sname()))
Added: CalendarServer/trunk/txdav/xml/test/__init__.py
===================================================================
--- CalendarServer/trunk/txdav/xml/test/__init__.py (rev 0)
+++ CalendarServer/trunk/txdav/xml/test/__init__.py 2012-03-16 19:25:34 UTC (rev 8895)
@@ -0,0 +1,19 @@
+##
+# Copyright (c) 2012 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.
+##
+
+"""
+WebDAV XML tests.
+"""
Copied: CalendarServer/trunk/txdav/xml/test/test_xml.py (from rev 8889, CalendarServer/trunk/twext/web2/dav/test/test_xml.py)
===================================================================
--- CalendarServer/trunk/txdav/xml/test/test_xml.py (rev 0)
+++ CalendarServer/trunk/txdav/xml/test/test_xml.py 2012-03-16 19:25:34 UTC (rev 8895)
@@ -0,0 +1,107 @@
+# Copyright (c) 2009 Twisted Matrix Laboratories.
+# See LICENSE for details.
+
+##
+# 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.
+##
+
+"""
+Tests for L{twext.web2.dav.davxml}.
+"""
+
+from twisted.trial.unittest import TestCase
+from twext.web2.dav.davxml import WebDAVDocument, WebDAVUnknownElement
+from twext.web2.dav.davxml import Response, HRef, MultiStatus, Status
+from twext.web2.dav.davxml import CurrentUserPrincipal
+
+
+class WebDAVElementTestsMixin:
+ """
+ Mixin for L{TestCase}s which test a L{WebDAVElement} subclass.
+ """
+ def test_fromString(self):
+ """
+ The XML representation of L{WebDAVDocument} can be parsed into a
+ L{WebDAVDocument} instance using L{WebDAVDocument.fromString}.
+ """
+ doc = WebDAVDocument.fromString(self.serialized)
+ self.assertEquals(doc, WebDAVDocument(self.element))
+
+
+ def test_toxml(self):
+ """
+ L{WebDAVDocument.toxml} returns a C{str} giving the XML representation
+ of the L{WebDAVDocument} instance.
+ """
+ document = WebDAVDocument(self.element)
+ self.assertEquals(
+ document,
+ WebDAVDocument.fromString(document.toxml()))
+
+
+class WebDAVUnknownElementTests(WebDAVElementTestsMixin, TestCase):
+ """
+ Tests for L{WebDAVUnknownElement}.
+ """
+ serialized = (
+ """<?xml version="1.0" encoding="utf-8" ?>"""
+ """<T:foo xmlns:T="http://twistedmatrix.com/"/>"""
+ )
+
+ element = WebDAVUnknownElement.withName(
+ "http://twistedmatrix.com/",
+ "foo"
+ )
+
+
+class MultiStatusTests(WebDAVElementTestsMixin, TestCase):
+ """
+ Tests for L{MultiStatus}
+ """
+ serialized = (
+ """<?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>"""
+ )
+
+ element = MultiStatus(
+ Response(
+ HRef("http://webdav.sb.aol.com/webdav/secret"),
+ Status("HTTP/1.1 403 Forbidden")),
+ )
+
+
+class CurrentUserPrincipalTests(WebDAVElementTestsMixin, TestCase):
+ """
+ Tests for L{CurrentUserPrincipal}.
+ """
+ serialized = (
+ """<?xml version="1.0" encoding="utf-8" ?>"""
+ """<D:current-user-principal xmlns:D="DAV:">"""
+ """ <D:href>foo</D:href>"""
+ """</D:current-user-principal>"""
+ )
+
+ element = CurrentUserPrincipal(HRef("foo"))
Copied: CalendarServer/trunk/txdav/xml/test/test_xml_rfc3744.py (from rev 8889, CalendarServer/trunk/twext/web2/dav/test/test_xml_rfc3744.py)
===================================================================
--- CalendarServer/trunk/txdav/xml/test/test_xml_rfc3744.py (rev 0)
+++ CalendarServer/trunk/txdav/xml/test/test_xml_rfc3744.py 2012-03-16 19:25:34 UTC (rev 8895)
@@ -0,0 +1,68 @@
+##
+# Copyright (c) 2005-2012 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 twext.web2.dav import davxml
+from twext.web2.dav.resource import davPrivilegeSet
+
+
+class XML_3744(unittest.TestCase):
+ """
+ RFC 3744 (WebDAV ACL) XML tests.
+ """
+ def test_Privilege_isAggregateOf(self):
+ """
+ Privilege.isAggregateOf()
+ """
+ for a, b in (
+ (davxml.All(), davxml.Write()),
+ (davxml.All(), davxml.ReadACL()),
+ (davxml.Write(), davxml.WriteProperties()),
+ (davxml.Write(), davxml.WriteContent()),
+ (davxml.Write(), davxml.Bind()),
+ (davxml.Write(), davxml.Unbind()),
+ ):
+ pa = davxml.Privilege(a)
+ pb = davxml.Privilege(b)
+
+ self.failUnless(
+ pa.isAggregateOf(pb, davPrivilegeSet),
+ "%s contains %s" % (a.sname(), b.sname())
+ )
+ self.failIf(
+ pb.isAggregateOf(pa, davPrivilegeSet),
+ "%s does not contain %s" % (b.sname(), a.sname())
+ )
+
+ for a, b in (
+ (davxml.Unlock(), davxml.Write()),
+ (davxml.Unlock(), davxml.WriteACL()),
+ (davxml.ReadCurrentUserPrivilegeSet(), davxml.WriteProperties()),
+ ):
+ pa = davxml.Privilege(a)
+ pb = davxml.Privilege(b)
+
+ self.failIf(
+ pb.isAggregateOf(pa, davPrivilegeSet),
+ "%s does not contain %s" % (b.sname(), a.sname())
+ )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120316/c7acbd89/attachment-0001.html>
More information about the calendarserver-changes
mailing list