Mercurial > treepkg
annotate test/test_notifications.py @ 481:9c7e1d957d6b
sawmill: Not all displayed times are in UTC so the
general 'Z's at all times/dates are removed. Now
it is only mentioned that the times in the main
table are in UTC. To reduce the optical noise
this is done by simple comments in the date rows.
author | Sascha Teichmann <teichmann@intevation.de> |
---|---|
date | Sat, 18 Sep 2010 07:50:53 +0000 |
parents | f06f707d9fda |
children | e5b66539f893 |
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 |
344
f06f707d9fda
merged branches/scratchbox into trunk
Bjoern Ricks <bricks@intevation.de>
parents:
293
diff
changeset
|
24 builderconfig: |
242
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 |
293
faeeac2c4c71
Replace debrevision_prefix with pkg_revision_template. Their meaning is
Bernhard Herzog <bh@intevation.de>
parents:
242
diff
changeset
|
27 pkg_revision_template: treepkg%%%%(pkg_revision)d |
242
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") |