annotate bitten/tests/web_ui.py @ 884:6b319a8ae32e 0.6.x

0.6dev: Merged [962] from trunk.
author osimons
date Fri, 10 Dec 2010 09:24:36 +0000
parents 8df9bc903edb
children
rev   line source
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
1 # -*- coding: utf-8 -*-
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
2 #
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
3 # Copyright (C) 2005-2007 Christopher Lenz <cmlenz@gmx.de>
833
f4d07544722b 0.6dev: Merged [910] from trunk.
osimons
parents: 813
diff changeset
4 # Copyright (C) 2007-2010 Edgewall Software
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
5 # All rights reserved.
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
6 #
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
7 # This software is licensed as described in the file COPYING, which
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
8 # you should have received as part of this distribution. The terms
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
9 # are also available at http://bitten.edgewall.org/wiki/License.
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
10
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
11 import shutil
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
12 import tempfile
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
13 import unittest
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
14
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
15 from trac.core import TracError
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
16 from trac.db import DatabaseManager
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
17 from trac.perm import PermissionCache, PermissionSystem
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
18 from trac.test import EnvironmentStub, Mock
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
19 from trac.util.html import Markup
575
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
20 from trac.web.api import HTTPNotFound
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
21 from trac.web.href import Href
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
22 from bitten.main import BuildSystem
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
23 from bitten.model import Build, BuildConfig, BuildStep, TargetPlatform, schema
575
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
24 from bitten.web_ui import BuildConfigController, BuildController, \
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
25 SourceFileLinkFormatter
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
26
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
27
575
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
28 class AbstractWebUITestCase(unittest.TestCase):
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
29
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
30 def setUp(self):
458
c9ac97df8a5e Fix build listener invocation.
cmlenz
parents: 440
diff changeset
31 self.env = EnvironmentStub(enable=['trac.*', 'bitten.*'])
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
32 self.env.path = tempfile.mkdtemp()
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
33
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
34 # Create tables
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
35 db = self.env.get_db_cnx()
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
36 cursor = db.cursor()
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
37 connector, _ = DatabaseManager(self.env)._get_connector()
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
38 for table in schema:
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
39 for stmt in connector.to_sql(table):
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
40 cursor.execute(stmt)
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
41
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
42 # Set up permissions
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
43 self.env.config.set('trac', 'permission_store',
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
44 'DefaultPermissionStore')
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
45
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
46 # Hook up a dummy repository
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
47 self.repos = Mock(
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
48 get_node=lambda path, rev=None: Mock(get_history=lambda: [],
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
49 isdir=True),
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
50 normalize_path=lambda path: path,
836
8df9bc903edb 0.6dev: Merged [912:913] from trunk.
osimons
parents: 833
diff changeset
51 normalize_rev=lambda rev: rev,
562
a8c84285e67a Complete rights restrictions for build configs etc - see #384. Also enhance tests to work with this code (but don't yet check that rights are restricted properly)
dfraser
parents: 528
diff changeset
52 sync=lambda: None,
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
53 )
562
a8c84285e67a Complete rights restrictions for build configs etc - see #384. Also enhance tests to work with this code (but don't yet check that rights are restricted properly)
dfraser
parents: 528
diff changeset
54 self.repos.authz = Mock(has_permission=lambda path: True, assert_permission=lambda path: None)
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
55 self.env.get_repository = lambda authname=None: self.repos
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
56
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
57 def tearDown(self):
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
58 shutil.rmtree(self.env.path)
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
59
575
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
60
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
61 class BuildConfigControllerTestCase(AbstractWebUITestCase):
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
62
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
63 def test_overview(self):
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
64 PermissionSystem(self.env).grant_permission('joe', 'BUILD_VIEW')
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
65 req = Mock(method='GET', base_path='', cgi_location='',
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
66 path_info='/build', href=Href('/trac'), args={}, chrome={},
562
a8c84285e67a Complete rights restrictions for build configs etc - see #384. Also enhance tests to work with this code (but don't yet check that rights are restricted properly)
dfraser
parents: 528
diff changeset
67 perm=PermissionCache(self.env, 'joe'), authname='joe')
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
68
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
69 module = BuildConfigController(self.env)
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
70 assert module.match_request(req)
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 458
diff changeset
71 _, data, _ = module.process_request(req)
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
72
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 458
diff changeset
73 self.assertEqual('overview', data['page_mode'])
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
74
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
75 def test_view_config(self):
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
76 config = BuildConfig(self.env, name='test', path='trunk')
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
77 config.insert()
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
78 platform = TargetPlatform(self.env, config='test', name='any')
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
79 platform.insert()
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
80
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
81 PermissionSystem(self.env).grant_permission('joe', 'BUILD_VIEW')
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
82 req = Mock(method='GET', base_path='', cgi_location='',
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
83 path_info='/build/test', href=Href('/trac'), args={},
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 458
diff changeset
84 chrome={}, authname='joe',
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
85 perm=PermissionCache(self.env, 'joe'))
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
86
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
87 root = Mock(get_entries=lambda: ['foo'],
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
88 get_history=lambda: [('trunk', rev, 'edit') for rev in
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
89 range(123, 111, -1)])
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
90 self.repos = Mock(get_node=lambda path, rev=None: root,
836
8df9bc903edb 0.6dev: Merged [912:913] from trunk.
osimons
parents: 833
diff changeset
91 sync=lambda: None, normalize_path=lambda path: path,
884
6b319a8ae32e 0.6dev: Merged [962] from trunk.
osimons
parents: 836
diff changeset
92 normalize_rev=lambda rev: rev, youngest_rev=123)
562
a8c84285e67a Complete rights restrictions for build configs etc - see #384. Also enhance tests to work with this code (but don't yet check that rights are restricted properly)
dfraser
parents: 528
diff changeset
93 self.repos.authz = Mock(has_permission=lambda path: True, assert_permission=lambda path: None)
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
94
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
95 module = BuildConfigController(self.env)
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
96 assert module.match_request(req)
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 458
diff changeset
97 _, data, _ = module.process_request(req)
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
98
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 458
diff changeset
99 self.assertEqual('view_config', data['page_mode'])
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 458
diff changeset
100 assert not 'next' in req.chrome['links']
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
101
629
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
102 from trac.resource import Resource
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
103 self.assertEquals(Resource('build', 'test'), data['context'].resource)
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
104
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
105 self.assertEquals([], data['config']['attachments']['attachments'])
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
106 self.assertEquals('/trac/attachment/build/test/',
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
107 data['config']['attachments']['attach_href'])
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
108
813
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
109 def test_bitten_keeps_order_of_revisions_from_versioncontrol(self):
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
110 # Trac's API specifies that they are sorted chronological (backwards)
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
111 # We must not assume that these revision numbers can be sorted later on,
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
112 # for example the mercurial plugin will return the revisions as strings
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
113 # (e.g. '880:4c19fa95fb9e')
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
114 config = BuildConfig(self.env, name='test', path='trunk')
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
115 config.insert()
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
116 platform = TargetPlatform(self.env, config='test', name='any')
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
117 platform.insert()
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
118
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
119 PermissionSystem(self.env).grant_permission('joe', 'BUILD_VIEW')
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
120 req = Mock(method='GET', base_path='', cgi_location='',
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
121 path_info='/build/'+config.name, href=Href('/trac'), args={},
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
122 chrome={}, authname='joe',
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
123 perm=PermissionCache(self.env, 'joe'))
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
124
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
125 # revisions are intentionally not sorted in any way - bitten should just keep them!
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
126 revision_ids = [5, 8, 2]
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
127 revision_list = [('trunk', revision, 'edit') for revision in revision_ids]
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
128 root = Mock(get_entries=lambda: ['foo'], get_history=lambda: revision_list)
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
129 self.repos = Mock(get_node=lambda path, rev=None: root,
836
8df9bc903edb 0.6dev: Merged [912:913] from trunk.
osimons
parents: 833
diff changeset
130 sync=lambda: None, normalize_path=lambda path: path,
884
6b319a8ae32e 0.6dev: Merged [962] from trunk.
osimons
parents: 836
diff changeset
131 normalize_rev=lambda rev: rev, youngest_rev=5)
813
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
132 self.repos.authz = Mock(has_permission=lambda path: True, assert_permission=lambda path: None)
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
133
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
134 module = BuildConfigController(self.env)
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
135 assert module.match_request(req)
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
136 _, data, _ = module.process_request(req)
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
137
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
138 actual_revision_ids = data['config']['revisions']
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
139 self.assertEquals(revision_ids, actual_revision_ids)
88454000acf8 0.6dev: Merged [890] from trunk.
osimons
parents: 629
diff changeset
140
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
141 def test_view_config_paging(self):
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
142 config = BuildConfig(self.env, name='test', path='trunk')
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
143 config.insert()
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
144 platform = TargetPlatform(self.env, config='test', name='any')
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
145 platform.insert()
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
146
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
147 PermissionSystem(self.env).grant_permission('joe', 'BUILD_VIEW')
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
148 req = Mock(method='GET', base_path='', cgi_location='',
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
149 path_info='/build/test', href=Href('/trac'), args={},
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 458
diff changeset
150 chrome={}, authname='joe',
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
151 perm=PermissionCache(self.env, 'joe'))
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
152
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
153 root = Mock(get_entries=lambda: ['foo'],
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
154 get_history=lambda: [('trunk', rev, 'edit') for rev in
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
155 range(123, 110, -1)])
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
156 self.repos = Mock(get_node=lambda path, rev=None: root,
836
8df9bc903edb 0.6dev: Merged [912:913] from trunk.
osimons
parents: 833
diff changeset
157 sync=lambda: None, normalize_path=lambda path: path,
884
6b319a8ae32e 0.6dev: Merged [962] from trunk.
osimons
parents: 836
diff changeset
158 normalize_rev=lambda rev: rev, youngest_rev=123)
562
a8c84285e67a Complete rights restrictions for build configs etc - see #384. Also enhance tests to work with this code (but don't yet check that rights are restricted properly)
dfraser
parents: 528
diff changeset
159 self.repos.authz = Mock(has_permission=lambda path: True, assert_permission=lambda path: None)
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
160
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
161 module = BuildConfigController(self.env)
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
162 assert module.match_request(req)
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 458
diff changeset
163 _, data, _ = module.process_request(req)
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
164
503
a7c795920c4a Merging trac-0.11 branch to trunk. This revision is equivalent to [571].
wbell
parents: 458
diff changeset
165 if req.chrome:
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
166 self.assertEqual('/trac/build/test?page=2',
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
167 req.chrome['links']['next'][0]['href'])
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
168
575
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
169 def test_raise_404(self):
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
170 PermissionSystem(self.env).grant_permission('joe', 'BUILD_VIEW')
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
171 module = BuildConfigController(self.env)
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
172 req = Mock(method='GET', base_path='', cgi_location='',
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
173 path_info='/build/nonexisting', href=Href('/trac'), args={},
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
174 chrome={}, authname='joe',
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
175 perm=PermissionCache(self.env, 'joe'))
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
176 self.failUnless(module.match_request(req))
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
177 try:
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
178 module.process_request(req)
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
179 except Exception, e:
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
180 self.failUnless(isinstance(e, HTTPNotFound))
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
181 self.assertEquals(str(e), "404 Not Found (Build configuration "
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
182 "'nonexisting' does not exist.)")
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
183 return
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
184 self.fail("This should have raised HTTPNotFound")
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
185
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
186
575
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
187 class BuildControllerTestCase(AbstractWebUITestCase):
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
188
629
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
189 def test_view_build(self):
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
190 config = BuildConfig(self.env, name='test', path='trunk')
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
191 config.insert()
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
192 platform = TargetPlatform(self.env, config='test', name='any')
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
193 platform.insert()
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
194 build = Build(self.env, config='test', platform=1, rev=123, rev_time=42,
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
195 status=Build.SUCCESS, slave='hal')
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
196 build.insert()
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
197
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
198 PermissionSystem(self.env).grant_permission('joe', 'BUILD_VIEW')
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
199 req = Mock(method='GET', base_path='', cgi_location='',
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
200 path_info='/build/test/1', href=Href('/trac'), args={},
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
201 chrome={}, authname='joe',
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
202 perm=PermissionCache(self.env, 'joe'))
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
203
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
204 root = Mock(get_entries=lambda: ['foo'],
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
205 get_history=lambda: [('trunk', rev, 'edit') for rev in
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
206 range(123, 111, -1)])
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
207 self.repos = Mock(get_node=lambda path, rev=None: root,
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
208 sync=lambda: None,
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
209 normalize_path=lambda path: path,
836
8df9bc903edb 0.6dev: Merged [912:913] from trunk.
osimons
parents: 833
diff changeset
210 normalize_rev=lambda rev: rev,
629
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
211 get_changeset=lambda rev: Mock(author='joe'))
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
212 self.repos.authz = Mock(has_permission=lambda path: True, assert_permission=lambda path: None)
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
213
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
214 module = BuildController(self.env)
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
215 assert module.match_request(req)
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
216 _, data, _ = module.process_request(req)
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
217
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
218 self.assertEqual('view_build', data['page_mode'])
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
219
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
220 from trac.resource import Resource
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
221 self.assertEquals(Resource('build', 'test/1'), data['context'].resource)
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
222
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
223 self.assertEquals([], data['build']['attachments']['attachments'])
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
224 self.assertEquals('/trac/attachment/build/test/1/',
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
225 data['build']['attachments']['attach_href'])
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
226
575
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
227 def test_raise_404(self):
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
228 PermissionSystem(self.env).grant_permission('joe', 'BUILD_VIEW')
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
229 module = BuildController(self.env)
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
230 config = BuildConfig(self.env, name='existing', path='trunk')
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
231 config.insert()
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
232 req = Mock(method='GET', base_path='', cgi_location='',
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
233 path_info='/build/existing/42', href=Href('/trac'), args={},
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
234 chrome={}, authname='joe',
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
235 perm=PermissionCache(self.env, 'joe'))
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
236 self.failUnless(module.match_request(req))
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
237 try:
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
238 module.process_request(req)
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
239 except Exception, e:
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
240 self.failUnless(isinstance(e, HTTPNotFound))
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
241 self.assertEquals(str(e),
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
242 "404 Not Found (Build '42' does not exist.)")
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
243 return
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
244 self.fail("This should have raised HTTPNotFound")
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
245
629
f3bb52da9e3c 0.6dev: Adding support for attachments to configurations and build - full web implementation that mirrors what is available in Ticket and Wiki. Also added a new generic `<attach/>` command that enables attaching files to be part of a recipe and uploaded by slaves as part of build.
osimons
parents: 593
diff changeset
246
575
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
247 class SourceFileLinkFormatterTestCase(AbstractWebUITestCase):
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
248
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
249 def test_format_simple_link_in_repos(self):
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
250 BuildConfig(self.env, name='test', path='trunk').insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
251 build = Build(self.env, config='test', platform=1, rev=123, rev_time=42,
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
252 status=Build.SUCCESS, slave='hal')
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
253 build.insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
254 step = BuildStep(self.env, build=build.id, name='foo',
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
255 status=BuildStep.SUCCESS)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
256 step.insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
257
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
258 self.repos.get_node = lambda path, rev: (path, rev)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
259
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
260 req = Mock(method='GET', href=Href('/trac'), authname='hal')
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
261 comp = SourceFileLinkFormatter(self.env)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
262 formatter = comp.get_formatter(req, build)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
263
593
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
264 # posix
440
e660687ac89c Follow-up fix to [486]: trailing chars in auto-linked log messages was getting removed.
cmlenz
parents: 439
diff changeset
265 output = formatter(step, None, None, u'error in foo/bar.c: bad')
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
266 self.assertEqual(Markup, type(output))
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
267 self.assertEqual('error in <a href="/trac/browser/trunk/foo/bar.c">'
440
e660687ac89c Follow-up fix to [486]: trailing chars in auto-linked log messages was getting removed.
cmlenz
parents: 439
diff changeset
268 'foo/bar.c</a>: bad', output)
593
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
269 # windows
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
270 output = formatter(step, None, None, u'error in foo\\win.c: bad')
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
271 self.assertEqual(Markup, type(output))
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
272 self.assertEqual(r'error in <a href="/trac/browser/trunk/foo/win.c">'
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
273 'foo\win.c</a>: bad', output)
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
274
528
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
275 def test_format_bad_links(self):
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
276 BuildConfig(self.env, name='test', path='trunk').insert()
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
277 build = Build(self.env, config='test', platform=1, rev=123, rev_time=42,
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
278 status=Build.SUCCESS, slave='hal')
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
279 build.insert()
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
280 step = BuildStep(self.env, build=build.id, name='foo',
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
281 status=BuildStep.SUCCESS)
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
282 step.insert()
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
283
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
284 self.repos.get_node = lambda path, rev: (path, rev)
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
285
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
286 req = Mock(method='GET', href=Href('/trac'), authname='hal')
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
287 comp = SourceFileLinkFormatter(self.env)
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
288 formatter = comp.get_formatter(req, build)
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
289
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
290 output = formatter(step, None, None, u'Linking -I../.. with ../libtool')
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
291 self.assertEqual(Markup, type(output))
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
292 self.assertEqual('Linking -I../.. with ../libtool', output)
f3bf55de8a34 Prevent path highlighting from passing non-canonical paths to svn:
dfraser
parents: 503
diff changeset
293
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
294 def test_format_simple_link_not_in_repos(self):
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
295 BuildConfig(self.env, name='test', path='trunk').insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
296 build = Build(self.env, config='test', platform=1, rev=123, rev_time=42,
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
297 status=Build.SUCCESS, slave='hal')
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
298 build.insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
299 step = BuildStep(self.env, build=build.id, name='foo',
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
300 status=BuildStep.SUCCESS)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
301 step.insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
302
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
303 def _raise():
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
304 raise TracError('No such node')
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
305 self.repos.get_node = lambda path, rev: _raise()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
306
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
307 req = Mock(method='GET', href=Href('/trac'), authname='hal')
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
308 comp = SourceFileLinkFormatter(self.env)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
309 formatter = comp.get_formatter(req, build)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
310
440
e660687ac89c Follow-up fix to [486]: trailing chars in auto-linked log messages was getting removed.
cmlenz
parents: 439
diff changeset
311 output = formatter(step, None, None, u'error in foo/bar.c: bad')
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
312 self.assertEqual(Markup, type(output))
440
e660687ac89c Follow-up fix to [486]: trailing chars in auto-linked log messages was getting removed.
cmlenz
parents: 439
diff changeset
313 self.assertEqual('error in foo/bar.c: bad', output)
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
314
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
315 def test_format_link_in_repos_with_line(self):
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
316 BuildConfig(self.env, name='test', path='trunk').insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
317 build = Build(self.env, config='test', platform=1, rev=123, rev_time=42,
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
318 status=Build.SUCCESS, slave='hal')
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
319 build.insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
320 step = BuildStep(self.env, build=build.id, name='foo',
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
321 status=BuildStep.SUCCESS)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
322 step.insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
323
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
324 self.repos.get_node = lambda path, rev: (path, rev)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
325
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
326 req = Mock(method='GET', href=Href('/trac'), authname='hal')
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
327 comp = SourceFileLinkFormatter(self.env)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
328 formatter = comp.get_formatter(req, build)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
329
593
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
330 # posix
440
e660687ac89c Follow-up fix to [486]: trailing chars in auto-linked log messages was getting removed.
cmlenz
parents: 439
diff changeset
331 output = formatter(step, None, None, u'error in foo/bar.c:123: bad')
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
332 self.assertEqual(Markup, type(output))
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
333 self.assertEqual('error in <a href="/trac/browser/trunk/foo/bar.c#L123">'
440
e660687ac89c Follow-up fix to [486]: trailing chars in auto-linked log messages was getting removed.
cmlenz
parents: 439
diff changeset
334 'foo/bar.c:123</a>: bad', output)
593
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
335 # windows
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
336 output = formatter(step, None, None, u'error in foo\\win.c:123: bad')
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
337 self.assertEqual(Markup, type(output))
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
338 self.assertEqual(r'error in <a href="/trac/browser/trunk/foo/win.c#L123">'
99831ab37fd3 0.6dev: Making source-linking work also for Windows-style file references (as output by Windows slaves). Thanks to Doug Patterson for updated regexp.
osimons
parents: 575
diff changeset
339 'foo\win.c:123</a>: bad', output)
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
340
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
341 def test_format_link_not_in_repos_with_line(self):
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
342 BuildConfig(self.env, name='test', path='trunk').insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
343 build = Build(self.env, config='test', platform=1, rev=123, rev_time=42,
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
344 status=Build.SUCCESS, slave='hal')
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
345 build.insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
346 step = BuildStep(self.env, build=build.id, name='foo',
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
347 status=BuildStep.SUCCESS)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
348 step.insert()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
349
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
350 def _raise():
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
351 raise TracError('No such node')
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
352 self.repos.get_node = lambda path, rev: _raise()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
353
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
354 req = Mock(method='GET', href=Href('/trac'), authname='hal')
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
355 comp = SourceFileLinkFormatter(self.env)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
356 formatter = comp.get_formatter(req, build)
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
357
440
e660687ac89c Follow-up fix to [486]: trailing chars in auto-linked log messages was getting removed.
cmlenz
parents: 439
diff changeset
358 output = formatter(step, None, None, u'error in foo/bar.c:123: bad')
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
359 self.assertEqual(Markup, type(output))
440
e660687ac89c Follow-up fix to [486]: trailing chars in auto-linked log messages was getting removed.
cmlenz
parents: 439
diff changeset
360 self.assertEqual('error in foo/bar.c:123: bad', output)
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
361
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
362
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
363 def suite():
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
364 suite = unittest.TestSuite()
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
365 suite.addTest(unittest.makeSuite(BuildConfigControllerTestCase, 'test'))
575
9ae8f6a95d4b 0.6dev: Adding tests for [645], and also reworked web_ui testcase classes to inherit from an abstract class that contains all the shared `setUp()` and `tearDown()` code.
osimons
parents: 562
diff changeset
366 suite.addTest(unittest.makeSuite(BuildControllerTestCase, 'test'))
439
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
367 suite.addTest(unittest.makeSuite(SourceFileLinkFormatterTestCase, 'test'))
20ddfbb8e879 Fix for #154, added unit tests.
cmlenz
parents: 436
diff changeset
368 return suite
410
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
369
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
370 if __name__ == '__main__':
7930cdd83d13 More restructuring: got rid of the `trac_ext` subpackage, which makes no sense now that the master is also coupled to Trac.
cmlenz
parents:
diff changeset
371 unittest.main(defaultTest='suite')
Copyright (C) 2012-2017 Edgewall Software