~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bugtracker.py

  • Committer: Patch Queue Manager
  • Date: 2015-10-05 13:45:00 UTC
  • mfrom: (6603.3.1 bts794146)
  • Revision ID: pqm@pqm.ubuntu.com-20151005134500-v244rho557tv0ukd
(vila) Resolve Bug #1480015: Test failure: hexify removed from paramiko
 (Andrew Starr-Bochicchio) (Andrew Starr-Bochicchio)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007-2010 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
 
        TestCaseWithMemoryTransport.setUp(self)
 
40
        super(TestGetBugURL, self).setUp()
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
 
120
128
    def test_generic_incorrect_url(self):
121
129
        branch = self.make_branch('some_branch')
122
130
        config = branch.get_config()
173
181
        self.assertRaises(
174
182
            errors.MalformedBugIdentifier, tracker.check_bug_id, 'red')
175
183
 
176
 
 
177
 
class TestURLParametrizedIntegerBugTracker(TestCaseWithMemoryTransport):
178
 
    """Tests for TracTracker."""
 
184
class TestURLParametrizedBugTracker(TestCaseWithMemoryTransport):
 
185
    """Tests for URLParametrizedBugTracker."""
179
186
 
180
187
    def setUp(self):
181
 
        TestCaseWithMemoryTransport.setUp(self)
 
188
        super(TestURLParametrizedBugTracker, self).setUp()
182
189
        self.url = 'http://twistedmatrix.com/trac'
183
 
        self.tracker = bugtracker.URLParametrizedIntegerBugTracker('some',
184
 
                                                                   'ticket/')
 
190
        self.tracker = bugtracker.URLParametrizedBugTracker('some', 'ticket/')
185
191
 
186
192
    def test_get_with_unsupported_tag(self):
187
193
        """If asked for an unrecognized or unconfigured tag, return None."""
203
209
            urlutils.join(self.url, 'ticket/') + '1234',
204
210
            tracker.get_bug_url('1234'))
205
211
 
 
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
 
206
228
    def test_get_bug_url_for_bad_bug(self):
207
229
        """When given a bug identifier that is invalid for Trac, get_bug_url
208
230
        should raise an error.