[CalendarServer-changes] [7281] CalendarServer/trunk/contrib/performance/loadtest/test_ical.py

source_changes at macosforge.org source_changes at macosforge.org
Fri Apr 1 10:11:47 PDT 2011


Revision: 7281
          http://trac.macosforge.org/projects/calendarserver/changeset/7281
Author:   exarkun at twistedmatrix.com
Date:     2011-04-01 10:11:46 -0700 (Fri, 01 Apr 2011)
Log Message:
-----------
Refactor request capturing code out of several test methods into a helper

Modified Paths:
--------------
    CalendarServer/trunk/contrib/performance/loadtest/test_ical.py

Modified: CalendarServer/trunk/contrib/performance/loadtest/test_ical.py
===================================================================
--- CalendarServer/trunk/contrib/performance/loadtest/test_ical.py	2011-03-31 20:17:24 UTC (rev 7280)
+++ CalendarServer/trunk/contrib/performance/loadtest/test_ical.py	2011-04-01 17:11:46 UTC (rev 7281)
@@ -871,18 +871,23 @@
         self.assertEquals(outbox.ctag, None)
 
 
-    def test_changeEventAttendee(self):
-        """
-        SnowLeopard.changeEventAttendee removes one attendee from an
-        existing event and appends another.
-        """
+    def interceptRequests(self):
         requests = []
         def request(*args):
             result = Deferred()
             requests.append((result, args))
             return result
         self.client._request = request
+        return requests
 
+
+    def test_changeEventAttendee(self):
+        """
+        SnowLeopard.changeEventAttendee removes one attendee from an
+        existing event and appends another.
+        """
+        requests = self.interceptRequests()
+
         vevent = list(readComponents(EVENT))[0]
         attendees = vevent.contents[u'vevent'][0].contents[u'attendee']
         old = attendees[0]
@@ -918,12 +923,7 @@
         L{SnowLeopard.addEvent} PUTs the event passed to it to the
         server and updates local state to reflect its existence.
         """
-        requests = []
-        def request(*args):
-            result = Deferred()
-            requests.append((result, args))
-            return result
-        self.client._request = request
+        requests = self.interceptRequests()
 
         vcalendar = list(readComponents(EVENT))[0]
         d = self.client.addEvent(u'/mumble/frotz.ics', vcalendar)
@@ -953,12 +953,7 @@
         URL passed to it and updates local state to reflect its
         removal.
         """
-        requests = []
-        def request(*args):
-            result = Deferred()
-            requests.append((result, args))
-            return result
-        self.client._request = request
+        requests = self.interceptRequests()
 
         calendar = Calendar(caldavxml.calendar, u'calendar', u'/foo/', None)
         event = Event(calendar.url + u'bar.ics', None)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110401/927501b8/attachment.html>


More information about the calendarserver-changes mailing list