[CalendarServer-changes] [7943] CalendarServer/branches/users/glyph/imip-and-admin-html/ calendarserver/webadmin/test/test_resource.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Aug 11 21:48:08 PDT 2011


Revision: 7943
          http://trac.macosforge.org/projects/calendarserver/changeset/7943
Author:   glyph at apple.com
Date:     2011-08-11 21:48:08 -0700 (Thu, 11 Aug 2011)
Log Message:
-----------
fill out the body of the dav property test

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/test/test_resource.py

Modified: CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/test/test_resource.py
===================================================================
--- CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/test/test_resource.py	2011-08-12 04:47:57 UTC (rev 7942)
+++ CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/test/test_resource.py	2011-08-12 04:48:08 UTC (rev 7943)
@@ -17,6 +17,9 @@
 """
 Tests for L{calendarserver.webadmin.resource}.
 """
+
+import cgi
+
 from functools import partial
 
 from twisted.trial.unittest import TestCase
@@ -24,11 +27,15 @@
 from twisted.web.microdom import parseString, getElementsByTagName
 from twisted.web.domhelpers import gatherTextNodes
 
+
 from calendarserver.tap.util import FakeRequest
 from twisted.internet.defer import inlineCallbacks
 from twisted.internet.defer import returnValue
 from calendarserver.webadmin.resource import WebAdminResource
+
 from twext.web2.dav.element.rfc3744 import GroupMemberSet
+from twext.web2.dav.element.rfc2518 import DisplayName
+
 from twistedcaldav.directory.directory import DirectoryRecord
 
 
@@ -177,10 +184,19 @@
         property is selected by the 'davPropertyName' parameter, that property
         will displayed.
         """
-        self.fail('implement')
+        self.resource.getResourceById = partial(FakePrincipalResource, self)
+        document = yield self.renderPage(
+            dict(resourceId=["qux"],
+                 davPropertyName=["DAV:#displayname"])
+        )
+        propertyName = document.getElementById('txt_davPropertyName')
+        self.assertEquals(propertyName.getAttribute("value"),
+                          "DAV:#displayname")
+        propertyValue = DisplayName("The Name To Display").toxml()
+        self.assertIn(cgi.escape(propertyValue),
+                      gatherTextNodes(document))
 
 
-
     realmName = 'Fake'
     guid = '28c57671-2bf8-4ebd-bc45-fda5ffcee1e8'
 
@@ -210,6 +226,8 @@
         return self
 
     def readProperty(self, name, request):
+        if name == DisplayName.qname():
+            return DisplayName("The Name To Display")
         return GroupMemberSet()
 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110811/a689d361/attachment-0001.html>


More information about the calendarserver-changes mailing list