[CalendarServer-changes] [11265] CalendarServer/trunk/twext/python/test/test_log.py

source_changes at macosforge.org source_changes at macosforge.org
Thu May 30 11:57:24 PDT 2013


Revision: 11265
          http://trac.calendarserver.org//changeset/11265
Author:   wsanchez at apple.com
Date:     2013-05-30 11:57:24 -0700 (Thu, 30 May 2013)
Log Message:
-----------
add test_invalidLogLevelName

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-05-30 18:43:41 UTC (rev 11264)
+++ CalendarServer/trunk/twext/python/test/test_log.py	2013-05-30 18:57:24 UTC (rev 11265)
@@ -18,8 +18,9 @@
 
 from twisted.python import log as twistedLogging
 
+from twext.python.log import LogLevel, InvalidLogLevelError
 from twext.python.log import logLevelsByNamespace, logLevelForNamespace
-from twext.python.log import LogLevel, setLogLevelForNamespace, clearLogLevels
+from twext.python.log import setLogLevelForNamespace, clearLogLevels
 from twext.python.log import pythonLogLevelMapping
 from twext.python.log import Logger
 
@@ -160,6 +161,19 @@
         self.failUnless(logLevelForNamespace("rocker.cool.namespace"), defaultLogLevel)
 
 
+    def test_invalidLogLevelName(self):
+        """
+        You can't make up log level names.
+        """
+        bogus = "*bogus*"
+        try:
+            LogLevel.levelWithName(bogus)
+        except InvalidLogLevelError as e:
+            self.assertIdentical(e.level, bogus)
+        else:
+            self.fail("Expected InvalidLogLevelError.")
+
+
     def test_logLevel(self):
         """
         Setting and retrieving log levels.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20130530/1de27dfa/attachment-0001.html>


More information about the calendarserver-changes mailing list