[Treepkg-commits] r168 - trunk/test

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Fri Jan 16 21:42:06 CET 2009


Author: bh
Date: 2009-01-16 21:42:06 +0100 (Fri, 16 Jan 2009)
New Revision: 168

Added:
   trunk/test/test_notifications.py
Log:
Add test for bin/listpendingnotifications.py


Added: trunk/test/test_notifications.py
===================================================================
--- trunk/test/test_notifications.py	2009-01-14 17:20:42 UTC (rev 167)
+++ trunk/test/test_notifications.py	2009-01-16 20:42:06 UTC (rev 168)
@@ -0,0 +1,68 @@
+# Copyright (C) 2009 by Intevation GmbH
+# Authors:
+# Bernhard Herzog <bh at intevation.de>
+#
+# This program is free software under the GPL (>=v2)
+# Read the file COPYING coming with the software for details.
+
+
+import sys
+import os
+import unittest
+
+from filesupport import FileTestMixin
+
+from treepkg.run import call, capture_output, SubprocessError
+
+
+class TestListNotifications(unittest.TestCase, FileTestMixin):
+
+    treepkg_cfg_template = """\
+[DEFAULT]
+tracks_dir: %(tracksdir)s
+root_cmd: true
+pbuilderrc:
+deb_email: packager at example.com
+deb_fullname: Sample Packager
+debrevision_prefix: treepkg
+handle_dependencies: False
+
+[treepkg]
+check_interval: 3600
+instructions_file:
+
+[pkg_kdepim]
+svn_url: svn://anonsvn.kde.org/home/kde/branches/kdepim/enterprise/kdepim
+base_dir: %%(tracks_dir)s/kdepim
+packager_class: recipes.kde_enterprise_3_5.kdepim
+"""
+
+    track_files = [("kdepim",
+                    [("pkg",
+                      [("704195-31",
+                        [("status", "TreePackagerStatus 0.0\n"),
+                         ("src", []),
+                         ("binary", [])]),
+                       ("702432-47",
+                        [("status",
+                          "\n".join(("TreePackagerStatus 0.0",
+                                     "status: error",
+                                     "notification_mail: notification_pending",
+                                     ""))),
+                         ("src", []),
+                         ("binary", [])])])])]
+
+    def setUp(self):
+        self.bindir = os.path.join(os.path.dirname(__file__),
+                                   os.pardir, "bin")
+        self.listpendingnotifications \
+                             = os.path.join(self.bindir,
+                                            "listpendingnotifications.py")
+        self.tracksdir = self.create_files("tracks", self.track_files)
+        config = self.treepkg_cfg_template % dict(tracksdir=self.tracksdir)
+        self.config_file = self.create_temp_file("treepkg.cfg", config)
+
+    def test_listpendingnotifications(self):
+        cmd = [sys.executable, self.listpendingnotifications,
+               "--config-file=" + self.config_file]
+        self.assertEquals(capture_output(cmd), "error kdepim 702432 47\n")


Property changes on: trunk/test/test_notifications.py
___________________________________________________________________
Name: svn:keywords
   + Id Revision
Name: svn:eol-style
   + native



More information about the Treepkg-commits mailing list