[Checkins] SVN: z3c.testsummarizer/trunk/src/z3c/testsummarizer/tests/test_archive.py Add test (the first!) for the URL/date scanning logic

Wolfgang Schnerring wosc at wosc.de
Mon Apr 4 12:17:53 EDT 2011


Log message for revision 121276:
  Add test (the first!) for the URL/date scanning logic
  

Changed:
  A   z3c.testsummarizer/trunk/src/z3c/testsummarizer/tests/test_archive.py

-=-
Added: z3c.testsummarizer/trunk/src/z3c/testsummarizer/tests/test_archive.py
===================================================================
--- z3c.testsummarizer/trunk/src/z3c/testsummarizer/tests/test_archive.py	                        (rev 0)
+++ z3c.testsummarizer/trunk/src/z3c/testsummarizer/tests/test_archive.py	2011-04-04 16:17:53 UTC (rev 121276)
@@ -0,0 +1,33 @@
+#############################################################################
+#
+# Copyright (c) 2011 Zope Foundation and Contributors.
+# All Rights Reserved.
+#
+# This software is subject to the provisions of the Zope Public License,
+# Version 2.1 (ZPL).  A copy of the ZPL should accompany this distribution.
+# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
+# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
+# FOR A PARTICULAR PURPOSE.
+#
+##############################################################################
+
+from z3c.testsummarizer.archive import Archive
+import datetime
+import pkg_resources
+import unittest
+
+
+class ArchiveTest(unittest.TestCase):
+
+    def setUp(self):
+        self.archive = Archive('file://' + pkg_resources.resource_filename(
+            'z3c.testsummarizer.tests', 'fixtures'))
+
+    def test_messages_are_scanned_in_reverse_chronological_order(self):
+        # the datetime of the first message in the fixture is (UTC!):
+        # datetime.datetime(2011, 2, 1, 5, 14, 47)
+        # so we choose a window that ends after that.
+        messages = self.archive.messages_sent_on(
+            datetime.datetime(2011, 2, 3, 19, 0))
+        self.assertEqual(28, len(messages))



More information about the checkins mailing list