~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bugtracker.py

  • Committer: Vincent Ladeuil
  • Date: 2010-03-10 09:33:04 UTC
  • mto: (5082.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5083.
  • Revision ID: v.ladeuil+lp@free.fr-20100310093304-4245t4tazd4sxoav
Cleanup test from overly cautious checks.

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
37
37
            return "http://bugs.com/%s" % bug_id
38
38
 
39
39
    def setUp(self):
40
 
        super(TestGetBugURL, self).setUp()
 
40
        TestCaseWithMemoryTransport.setUp(self)
41
41
        self.tracker_type = TestGetBugURL.TransientTracker
42
42
        self.tracker_type.log = []
43
43
        bugtracker.tracker_registry.register('transient', self.tracker_type)
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
 
        super(TestURLParametrizedBugTracker, self).setUp()
 
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
 
        super(TestURLParametrizedIntegerBugTracker, self).setUp()
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.