~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bugtracker.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-05-28 00:25:32 UTC
  • mfrom: (5264.1.2 command-help-bug-177500)
  • Revision ID: pqm@pqm.ubuntu.com-20100528002532-9bzj1fajyxckd1rg
(lifeless) Stop raising at runtime when a command has no help,
 instead have a test in the test suite that checks all known command objects.
 (Robert Collins)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007-2010 Canonical Ltd
 
1
# Copyright (C) 2007 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
117
117
        self.assertEqual('http://bugs.com/1234/view.html',
118
118
                         tracker.get_bug_url('1234'))
119
119
 
120
 
    def test_generic_registered_non_integer(self):
121
 
        branch = self.make_branch('some_branch')
122
 
        config = branch.get_config()
123
 
        config.set_user_option('bugtracker_foo_url', 'http://bugs.com/{id}/view.html')
124
 
        tracker = bugtracker.tracker_registry.get_tracker('foo', branch)
125
 
        self.assertEqual('http://bugs.com/ABC-1234/view.html',
126
 
                         tracker.get_bug_url('ABC-1234'))
127
 
 
128
120
    def test_generic_incorrect_url(self):
129
121
        branch = self.make_branch('some_branch')
130
122
        config = branch.get_config()
181
173
        self.assertRaises(
182
174
            errors.MalformedBugIdentifier, tracker.check_bug_id, 'red')
183
175
 
184
 
class TestURLParametrizedBugTracker(TestCaseWithMemoryTransport):
185
 
    """Tests for URLParametrizedBugTracker."""
 
176
 
 
177
class TestURLParametrizedIntegerBugTracker(TestCaseWithMemoryTransport):
 
178
    """Tests for TracTracker."""
186
179
 
187
180
    def setUp(self):
188
181
        TestCaseWithMemoryTransport.setUp(self)
189
182
        self.url = 'http://twistedmatrix.com/trac'
190
 
        self.tracker = bugtracker.URLParametrizedBugTracker('some', 'ticket/')
 
183
        self.tracker = bugtracker.URLParametrizedIntegerBugTracker('some',
 
184
                                                                   'ticket/')
191
185
 
192
186
    def test_get_with_unsupported_tag(self):
193
187
        """If asked for an unrecognized or unconfigured tag, return None."""
209
203
            urlutils.join(self.url, 'ticket/') + '1234',
210
204
            tracker.get_bug_url('1234'))
211
205
 
212
 
    def test_get_bug_url_for_integer_id(self):
213
 
        self.tracker.check_bug_id('1234')
214
 
 
215
 
    def test_get_bug_url_for_non_integer_id(self):
216
 
        self.tracker.check_bug_id('ABC-1234')
217
 
 
218
 
 
219
 
class TestURLParametrizedIntegerBugTracker(TestCaseWithMemoryTransport):
220
 
    """Tests for URLParametrizedIntegerBugTracker."""
221
 
 
222
 
    def setUp(self):
223
 
        TestCaseWithMemoryTransport.setUp(self)
224
 
        self.url = 'http://twistedmatrix.com/trac'
225
 
        self.tracker = bugtracker.URLParametrizedIntegerBugTracker('some',
226
 
                                                                   'ticket/')
227
 
 
228
206
    def test_get_bug_url_for_bad_bug(self):
229
207
        """When given a bug identifier that is invalid for Trac, get_bug_url
230
208
        should raise an error.