[CalendarServer-changes] [11675] CalendarServer/trunk/twext/python/test/test_log.py
source_changes at macosforge.org
source_changes at macosforge.org
Thu Sep 12 11:06:54 PDT 2013
Revision: 11675
http://trac.calendarserver.org//changeset/11675
Author: wsanchez at apple.com
Date: 2013-09-12 11:06:54 -0700 (Thu, 12 Sep 2013)
Log Message:
-----------
Add test for unformattable key in log event.
Modified Paths:
--------------
CalendarServer/trunk/twext/python/test/test_log.py
Modified: CalendarServer/trunk/twext/python/test/test_log.py
===================================================================
--- CalendarServer/trunk/twext/python/test/test_log.py 2013-09-12 18:01:15 UTC (rev 11674)
+++ CalendarServer/trunk/twext/python/test/test_log.py 2013-09-12 18:06:54 UTC (rev 11675)
@@ -265,7 +265,7 @@
self.assertIn(repr(event), result)
- def test_formatEventYouSoNasty(self):
+ def test_formatUnformattableEvent(self):
"""
Formatting an event that's just plain out to get us.
"""
@@ -276,16 +276,37 @@
self.assertIn(repr(event), result)
- def test_formatEventYouSoNastyUnformattableValue(self):
+ def test_formatUnformattableEventWithUnformattableKey(self):
"""
- Formatting an event that's just plain out to get us and is
- really determined.
+ Formatting an unformattable event that has an unformattable key.
"""
class Gurk(object):
# Class that raises in C{__repr__()}.
def __repr__(self):
return str(1/0)
+ event = {
+ "log_format": "{evil()}",
+ "evil": lambda: 1/0,
+ Gurk(): "gurk",
+ }
+ result = formatEvent(event)
+
+ self.assertIn("MESSAGE LOST: unformattable object logged.", result)
+ self.assertIn("Recoverable data:", result)
+ self.assertIn("Exception during formatting:", result)
+ #self.assertIn(repr(event), result)
+
+
+ def test_formatUnformattableEventWithUnformattableValue(self):
+ """
+ Formatting an unformattable event that has an unformattable value.
+ """
+ class Gurk(object):
+ # Class that raises in C{__repr__()}.
+ def __repr__(self):
+ return str(1/0)
+
event = dict(
log_format="{evil()}",
evil=lambda: 1/0,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130912/98ab8eed/attachment-0001.html>
More information about the calendarserver-changes
mailing list