[CalendarServer-changes] [8897] CalendarServer/trunk/txdav/xml/test

source_changes at macosforge.org source_changes at macosforge.org
Fri Mar 16 13:42:16 PDT 2012


Revision: 8897
          http://trac.macosforge.org/projects/calendarserver/changeset/8897
Author:   wsanchez at apple.com
Date:     2012-03-16 13:42:15 -0700 (Fri, 16 Mar 2012)
Log Message:
-----------
Reorg

Modified Paths:
--------------
    CalendarServer/trunk/txdav/xml/test/test_xml.py

Added Paths:
-----------
    CalendarServer/trunk/txdav/xml/test/test_base.py

Added: CalendarServer/trunk/txdav/xml/test/test_base.py
===================================================================
--- CalendarServer/trunk/txdav/xml/test/test_base.py	                        (rev 0)
+++ CalendarServer/trunk/txdav/xml/test/test_base.py	2012-03-16 20:42:15 UTC (rev 8897)
@@ -0,0 +1,70 @@
+# Copyright (c) 2009 Twisted Matrix Laboratories.
+# See LICENSE for details.
+
+##
+# 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.
+##
+
+"""
+Tests for L{txdav.xml.base}.
+"""
+
+from twisted.trial.unittest import TestCase
+from twext.web2.dav.davxml import WebDAVDocument, WebDAVUnknownElement
+
+
+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"
+    )

Modified: CalendarServer/trunk/txdav/xml/test/test_xml.py
===================================================================
--- CalendarServer/trunk/txdav/xml/test/test_xml.py	2012-03-16 20:06:31 UTC (rev 8896)
+++ CalendarServer/trunk/txdav/xml/test/test_xml.py	2012-03-16 20:42:15 UTC (rev 8897)
@@ -2,7 +2,7 @@
 # See LICENSE for details.
 
 ##
-# Copyright (c) 2005 Apple Computer, Inc. All rights reserved.
+# 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
@@ -24,54 +24,15 @@
 ##
 
 """
-Tests for L{twext.web2.dav.davxml}.
+Tests for L{txdav.xml}.
 """
 
 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
+from txdav.xml.test.test_base import WebDAVElementTestsMixin
 
 
-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}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20120316/6acc6a0c/attachment.html>


More information about the calendarserver-changes mailing list