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