annotate test/test_notifications.py @ 441:eadcb1bb54e2

Merged revisions 388-399 via svnmerge from svn+ssh://svn.wald.intevation.org/treepkg/branches/treepkg-status ........ r388 | bricks | 2010-07-28 10:38:50 +0200 (Mi, 28 Jul 2010) | 3 lines fix if statement upload hook should be called if it's not empty ........ r389 | bricks | 2010-07-28 13:38:00 +0200 (Mi, 28 Jul 2010) | 2 lines only rsync specified architectures from cachedir to publishdir ........ r390 | bricks | 2010-07-29 14:07:57 +0200 (Do, 29 Jul 2010) | 2 lines introduced after_copy_hook and made rsync upload to publishdir optional ........ r391 | bricks | 2010-07-29 15:43:39 +0200 (Do, 29 Jul 2010) | 3 lines publish package must be default to get original behaviour be more verbose at publishing ........ r392 | bricks | 2010-07-29 16:50:53 +0200 (Do, 29 Jul 2010) | 2 lines fix handling of showing only successfull builds together with num packages ........ r393 | bricks | 2010-07-29 16:52:42 +0200 (Do, 29 Jul 2010) | 2 lines fixed typo ........ r394 | bricks | 2010-07-29 16:59:10 +0200 (Do, 29 Jul 2010) | 2 lines fixed another typo ........ r395 | bricks | 2010-07-29 18:05:54 +0200 (Do, 29 Jul 2010) | 3 lines fixed another typo treepkg is really slow with many revisions ........ r396 | bricks | 2010-08-02 12:41:55 +0200 (Mo, 02 Aug 2010) | 2 lines fixed typos ........ r397 | bricks | 2010-08-02 17:36:12 +0200 (Mo, 02 Aug 2010) | 3 lines be more error prone in listing different files not checking if a dir exists caused several errors if a build wasn't successful ........ r398 | bricks | 2010-08-05 18:21:47 +0200 (Do, 05 Aug 2010) | 2 lines review changes ........ r399 | bricks | 2010-08-06 13:06:08 +0200 (Fr, 06 Aug 2010) | 4 lines cleanup modules fix test_info testcases added testcases for remove_trailingslashes and expand_filename ........
author Bjoern Ricks <bricks@intevation.de>
date Fri, 06 Aug 2010 13:41:54 +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")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)