comparison test/test_info.py @ 388:1af04bfbb1d0 treepkg-status

moved test file to test main dir fixed missing : after def statement
author Bjoern Ricks <bricks@intevation.de>
date Thu, 08 Jul 2010 13:25:07 +0000
parents
children e2afbd3c2bf1
comparison
equal deleted inserted replaced
387:c1f3be727f9d 388:1af04bfbb1d0
1 # Copyright (C) 2010 by Intevation GmbH
2 # Authors:
3 # Bjoern Ricks <bjoern.ricks@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 """Tests for treepkg.status.status"""
9
10 import unittest
11 import os.path
12 import sys
13
14 test_dir = os.path.dirname(__file__)
15 sys.path.append(os.path.join(test_dir, os.pardir))
16
17 from treepkg.info.status import TreepkgInfo
18 from treepkg.report import get_packager_group
19 from filesupport import FileTestMixin
20
21 class TreepkgInfoExampleTest(unittest.TestCase, FileTestMixin):
22 config_contents = """\
23 [DEFAULT]
24 treepkg_dir: /home/builder/mill
25 tracks_dir: %(treepkg_dir)s/tracks
26 root_cmd: sudo
27 pbuilder_dir: %(treepkg_dir)s/pbuilder
28 builderconfig: %(pbuilder_dir)s/pbuilderrc
29 deb_email: treepkg@example.com
30 deb_fullname: TreePKG
31 pkg_revision_template: treepkg%%(pkg_revision)s
32 handle_dependencies: False
33
34 [treepkg]
35 instructions_file: %(treepkg_dir)s/instructions
36 check_interval: 3600
37 name: testtreepkginfo
38
39 [pkg_simple]
40 pkg_basename: simple1
41 svn_url: svn://example.com/%(name)s/trunk
42 base_dir: %(tracks_dir)s/%(name)s
43 packager_class: treepkginfo_test.%(name)s
44 handle_dependencies: True
45 signing_key_id: abcd1234
46 changelog_msg_template: Update to feature branch r%%(revision)s
47 version_template: 1.0.svn%%(revision)s
48
49 """
50
51 files = [("treepkg.cfg", config_contents),
52 ("treepkginfo_test",
53 [("__init__.py", ""),
54 ("simple.py",
55 "\n".join(["class SourcePackager:",
56 " pass",
57 ""])),
58 ])]
59
60 def setUp(self):
61 self.directory = self.create_files("treepkg", self.files)
62 self.old_path = sys.path
63 sys.path = [self.directory] + sys.path
64
65 def tearDown(self):
66 sys.path = self.old_path
67
68 def test_createinfo(self):
69 config_file = os.path.join(self.directory, "treepkg.cfg")
70 group = get_packager_group(config_file)
71 tpginfo = TreepkgInfo(group.name)
72 print tpginfo.toxml().toxml()
73 self.assertEquals("testtreepkginfo", tpginfo.name)
74
75
76 class TreepkgInfoTest(unittest.TestCase):
77
78 def test_toxml(self):
79 status = TreepkgInfo("testtreepkg")
80 dom = status.toxml()
81 xml = dom.toxml()
82 self.assertEquals("<status><name>testtreepkg</name></status>", xml)
83
84 if __name__ == '__main__':
85 unittest.main()
86
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)