Mercurial > treepkg
comparison test/test_notifications.py @ 242:351427b28b76
Add test for bin/listpendingnotifications.py
author | Bernhard Herzog <bh@intevation.de> |
---|---|
date | Fri, 16 Jan 2009 20:42:06 +0000 |
parents | |
children | faeeac2c4c71 |
comparison
equal
deleted
inserted
replaced
241:df3065e4c76b | 242:351427b28b76 |
---|---|
1 # Copyright (C) 2009 by Intevation GmbH | |
2 # Authors: | |
3 # Bernhard Herzog <bh@intevation.de> | |
4 # | |
5 # This program is free software under the GPL (>=v2) | |
6 # Read the file COPYING coming with the software for details. | |
7 | |
8 | |
9 import sys | |
10 import os | |
11 import unittest | |
12 | |
13 from filesupport import FileTestMixin | |
14 | |
15 from treepkg.run import call, capture_output, SubprocessError | |
16 | |
17 | |
18 class TestListNotifications(unittest.TestCase, FileTestMixin): | |
19 | |
20 treepkg_cfg_template = """\ | |
21 [DEFAULT] | |
22 tracks_dir: %(tracksdir)s | |
23 root_cmd: true | |
24 pbuilderrc: | |
25 deb_email: packager@example.com | |
26 deb_fullname: Sample Packager | |
27 debrevision_prefix: treepkg | |
28 handle_dependencies: False | |
29 | |
30 [treepkg] | |
31 check_interval: 3600 | |
32 instructions_file: | |
33 | |
34 [pkg_kdepim] | |
35 svn_url: svn://anonsvn.kde.org/home/kde/branches/kdepim/enterprise/kdepim | |
36 base_dir: %%(tracks_dir)s/kdepim | |
37 packager_class: recipes.kde_enterprise_3_5.kdepim | |
38 """ | |
39 | |
40 track_files = [("kdepim", | |
41 [("pkg", | |
42 [("704195-31", | |
43 [("status", "TreePackagerStatus 0.0\n"), | |
44 ("src", []), | |
45 ("binary", [])]), | |
46 ("702432-47", | |
47 [("status", | |
48 "\n".join(("TreePackagerStatus 0.0", | |
49 "status: error", | |
50 "notification_mail: notification_pending", | |
51 ""))), | |
52 ("src", []), | |
53 ("binary", [])])])])] | |
54 | |
55 def setUp(self): | |
56 self.bindir = os.path.join(os.path.dirname(__file__), | |
57 os.pardir, "bin") | |
58 self.listpendingnotifications \ | |
59 = os.path.join(self.bindir, | |
60 "listpendingnotifications.py") | |
61 self.tracksdir = self.create_files("tracks", self.track_files) | |
62 config = self.treepkg_cfg_template % dict(tracksdir=self.tracksdir) | |
63 self.config_file = self.create_temp_file("treepkg.cfg", config) | |
64 | |
65 def test_listpendingnotifications(self): | |
66 cmd = [sys.executable, self.listpendingnotifications, | |
67 "--config-file=" + self.config_file] | |
68 self.assertEquals(capture_output(cmd), "error kdepim 702432 47\n") |