[CalendarServer-changes] [7960] 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:51:21 PDT 2011


Revision: 7960
          http://trac.macosforge.org/projects/calendarserver/changeset/7960
Author:   glyph at apple.com
Date:     2011-08-11 21:51:21 -0700 (Thu, 11 Aug 2011)
Log Message:
-----------
test for proxy search results table

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:51:09 UTC (rev 7959)
+++ CalendarServer/branches/users/glyph/imip-and-admin-html/calendarserver/webadmin/test/test_resource.py	2011-08-12 04:51:21 UTC (rev 7960)
@@ -100,10 +100,10 @@
         self.assertEquals(document.documentElement.tagName, 'html')
 
 
-    @inlineCallbacks
-    def test_resourceSearch(self):
+    def expectSomeRecords(self):
         """
-        Searching for resources should result in an HTML table resource search.
+        Sample invocation of expectRecordSearch that includes two sample
+        directory records.
         """
         self.expectRecordSearch(
             "bob", [
@@ -120,6 +120,14 @@
                      ["bobd at example.com"]),
                    ]
             ])
+
+
+    @inlineCallbacks
+    def test_resourceSearch(self):
+        """
+        Searching for resources should result in an HTML table resource search.
+        """
+        self.expectSomeRecords()
         document = yield self.renderPage(dict(resourceSearch=["bob"]))
 
         # Form is filled out with existing input.
@@ -151,6 +159,33 @@
 
 
     @inlineCallbacks
+    def test_proxySearch(self):
+        """
+        Test for searching for a proxy.
+        """
+        self.expectSomeRecords()
+        self.resource.getResourceById = partial(FakePrincipalResource, self)
+        document = yield self.renderPage(dict(resourceId=["qux"],
+                                              proxySearch=["bob"]))
+
+        # Form is filled out with existing input.
+        self.assertEquals(
+            document.getElementById("txt_proxySearch").getAttribute("value"),
+            "bob"
+        )
+        proxyAddForm = document.getElementById("frm_proxyAdd")
+        [proxyResultsTable] = getElementsByTagName(proxyAddForm, "table")
+
+        rows = getElementsByTagName(proxyResultsTable, 'tr')
+        self.assertEquals(len(rows), 3)
+        firstRowCells = getElementsByTagName(rows[1], 'td')
+        self.assertEquals(
+            [gatherTextNodes(cell) for cell in firstRowCells[1:]],
+            ["User", "bob", "bob at example.com, bob at other.example.com", ""]
+        )
+
+
+    @inlineCallbacks
     def test_noResourceFound(self):
         """
         Searching for resources which don't exist should result in an
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110811/0a818a23/attachment-0001.html>


More information about the calendarserver-changes mailing list