[CalendarServer-changes] [7446] CalendarServer/branches/users/glyph/new-export/calendarserver/tools

source_changes at macosforge.org source_changes at macosforge.org
Mon May 16 07:40:22 PDT 2011


Revision: 7446
          http://trac.macosforge.org/projects/calendarserver/changeset/7446
Author:   glyph at apple.com
Date:     2011-05-16 07:40:22 -0700 (Mon, 16 May 2011)
Log Message:
-----------
Very, very basic test (which fails because it's unimportable).

Modified Paths:
--------------
    CalendarServer/branches/users/glyph/new-export/calendarserver/tools/export.py

Added Paths:
-----------
    CalendarServer/branches/users/glyph/new-export/calendarserver/tools/test/test_export.py

Modified: CalendarServer/branches/users/glyph/new-export/calendarserver/tools/export.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/calendarserver/tools/export.py	2011-05-16 14:40:01 UTC (rev 7445)
+++ CalendarServer/branches/users/glyph/new-export/calendarserver/tools/export.py	2011-05-16 14:40:22 UTC (rev 7446)
@@ -1,5 +1,5 @@
 #!/usr/bin/env python
-
+# -*- test-case-name: calendarserver.tools.test.test_export -*-
 ##
 # Copyright (c) 2006-2009 Apple Inc. All rights reserved.
 #

Added: CalendarServer/branches/users/glyph/new-export/calendarserver/tools/test/test_export.py
===================================================================
--- CalendarServer/branches/users/glyph/new-export/calendarserver/tools/test/test_export.py	                        (rev 0)
+++ CalendarServer/branches/users/glyph/new-export/calendarserver/tools/test/test_export.py	2011-05-16 14:40:22 UTC (rev 7446)
@@ -0,0 +1,51 @@
+##
+# Copyright (c) 2011 Apple Inc. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##
+
+"""
+Unit tests for L{calendarsever.tools.export}.
+"""
+
+
+import sys
+from cStringIO import StringIO
+
+from twisted.trial.unittest import TestCase
+
+from calendarserver.tools.export import usage
+
+class CommandLine(TestCase):
+    """
+    Simple tests for command-line parsing.
+    """
+
+    def test_usageMessage(self):
+        """
+        The 'usage' message should print something to standard output and exit.
+        """
+        orig = sys.stdout
+        orige = sys.stderr
+        try:
+            out = sys.stdout = StringIO()
+            err = sys.stderr = StringIO()
+            usage()
+        finally:
+            sys.stdout = orig
+            sys.stderr = orige
+        self.assertGreaterThan(len(out.getvalue()), 0)
+        self.assertEquals(len(err.getvalue()), 0)
+
+
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20110516/cc10a2aa/attachment.html>


More information about the calendarserver-changes mailing list