/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bugtracker.py

  • Committer: Richard Wilbur
  • Date: 2016-02-04 19:07:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6618.
  • Revision ID: richard.wilbur@gmail.com-20160204190728-p0zvfii6zase0fw7
Update COPYING.txt from the original http://www.gnu.org/licenses/gpl-2.0.txt  (Only differences were in whitespace.)  Thanks to Petr Stodulka for pointing out the discrepancy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
 
from .. import bugtracker, urlutils
19
 
from . import TestCase, TestCaseWithMemoryTransport
20
 
 
21
 
 
22
 
class ErrorsTest(TestCaseWithMemoryTransport):
23
 
 
24
 
    def test_unknown_bug_tracker_abbreviation(self):
25
 
        """Test the formatting of UnknownBugTrackerAbbreviation."""
26
 
        branch = self.make_branch('some_branch')
27
 
        error = bugtracker.UnknownBugTrackerAbbreviation('xxx', branch)
28
 
        self.assertEqual(
29
 
            "Cannot find registered bug tracker called xxx on %s" % branch,
30
 
            str(error))
31
 
 
32
 
    def test_malformed_bug_identifier(self):
33
 
        """Test the formatting of MalformedBugIdentifier."""
34
 
        error = bugtracker.MalformedBugIdentifier(
35
 
            'bogus', 'reason for bogosity')
36
 
        self.assertEqual(
37
 
            'Did not understand bug identifier bogus: reason for bogosity. '
38
 
            'See "brz help bugs" for more information on this feature.',
39
 
            str(error))
40
 
 
41
 
    def test_incorrect_url(self):
42
 
        err = bugtracker.InvalidBugTrackerURL('foo', 'http://bug.com/')
43
 
        self.assertEqual(
44
 
            ("The URL for bug tracker \"foo\" doesn't contain {id}: "
45
 
             "http://bug.com/"),
46
 
            str(err))
 
18
from bzrlib import bugtracker, errors, urlutils
 
19
from bzrlib.tests import TestCase, TestCaseWithMemoryTransport
47
20
 
48
21
 
49
22
class TestGetBugURL(TestCaseWithMemoryTransport):
81
54
    def test_unrecognized_abbreviation_raises_error(self):
82
55
        """If the abbreviation is unrecognized, then raise an error."""
83
56
        branch = self.make_branch('some_branch')
84
 
        self.assertRaises(bugtracker.UnknownBugTrackerAbbreviation,
 
57
        self.assertRaises(errors.UnknownBugTrackerAbbreviation,
85
58
                          bugtracker.get_bug_url, 'xxx', branch, '1234')
86
59
        self.assertEqual([('get', 'xxx', branch)], self.tracker_type.log)
87
60
 
157
130
        config = branch.get_config()
158
131
        config.set_user_option('bugtracker_foo_url', 'http://bugs.com/view.html')
159
132
        tracker = bugtracker.tracker_registry.get_tracker('foo', branch)
160
 
        self.assertRaises(bugtracker.InvalidBugTrackerURL, tracker.get_bug_url,
161
 
                '1234')
 
133
        self.assertRaises(errors.InvalidBugTrackerURL, tracker.get_bug_url, '1234')
162
134
 
163
135
 
164
136
class TestUniqueIntegerBugTracker(TestCaseWithMemoryTransport):
207
179
        tracker = bugtracker.UniqueIntegerBugTracker('xxx',
208
180
                'http://bugs.com/')
209
181
        self.assertRaises(
210
 
            bugtracker.MalformedBugIdentifier, tracker.check_bug_id, 'red')
 
182
            errors.MalformedBugIdentifier, tracker.check_bug_id, 'red')
211
183
 
212
184
class TestURLParametrizedBugTracker(TestCaseWithMemoryTransport):
213
185
    """Tests for URLParametrizedBugTracker."""
258
230
        should raise an error.
259
231
        """
260
232
        self.assertRaises(
261
 
            bugtracker.MalformedBugIdentifier, self.tracker.get_bug_url, 'bad')
 
233
            errors.MalformedBugIdentifier, self.tracker.get_bug_url, 'bad')
262
234
 
263
235
 
264
236
class TestPropertyEncoding(TestCase):