~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bugtracker.py

  • Committer: Andrew Bennetts
  • Date: 2008-04-07 08:20:13 UTC
  • mfrom: (3340 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3344.
  • Revision ID: andrew.bennetts@canonical.com-20080407082013-ca1n1tqqon7ugxiy
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
81
81
        self.assertEqual('http://bugs.debian.org/1234',
82
82
                         tracker.get_bug_url('1234'))
83
83
 
 
84
    def test_gnome_registered(self):
 
85
        branch = self.make_branch('some_branch')
 
86
        tracker = bugtracker.tracker_registry.get_tracker('gnome', branch)
 
87
        self.assertEqual('http://bugzilla.gnome.org/show_bug.cgi?id=1234',
 
88
                         tracker.get_bug_url('1234'))
 
89
 
84
90
    def test_trac_registered(self):
85
91
        """The Trac bug tracker should be registered by default and generate
86
92
        Trac bug page URLs when the appropriate configuration is present.
122
128
 
123
129
class TestUniqueIntegerBugTracker(TestCaseWithMemoryTransport):
124
130
 
125
 
    def test_joins_id_to_base_url(self):
 
131
    def test_appends_id_to_base_url(self):
126
132
        """The URL of a bug is the base URL joined to the identifier."""
127
 
        tracker = bugtracker.UniqueIntegerBugTracker('xxx', 'http://bugs.com')
128
 
        self.assertEqual('http://bugs.com/1234', tracker.get_bug_url('1234'))
 
133
        tracker = bugtracker.UniqueIntegerBugTracker('xxx',
 
134
                'http://bugs.com/foo')
 
135
        self.assertEqual('http://bugs.com/foo1234', tracker.get_bug_url('1234'))
129
136
 
130
137
    def test_returns_tracker_if_abbreviation_matches(self):
131
138
        """The get() method should return an instance of the tracker if the
132
139
        given abbreviation matches the tracker's abbreviated name.
133
140
        """
134
 
        tracker = bugtracker.UniqueIntegerBugTracker('xxx', 'http://bugs.com')
 
141
        tracker = bugtracker.UniqueIntegerBugTracker('xxx',
 
142
                'http://bugs.com/')
135
143
        branch = self.make_branch('some_branch')
136
144
        self.assertIs(tracker, tracker.get('xxx', branch))
137
145
 
139
147
        """The get() method should return None if the given abbreviated name
140
148
        doesn't match the tracker's abbreviation.
141
149
        """
142
 
        tracker = bugtracker.UniqueIntegerBugTracker('xxx', 'http://bugs.com')
 
150
        tracker = bugtracker.UniqueIntegerBugTracker('xxx',
 
151
                'http://bugs.com/')
143
152
        branch = self.make_branch('some_branch')
144
153
        self.assertIs(None, tracker.get('yyy', branch))
145
154
 
147
156
        """A UniqueIntegerBugTracker shouldn't consult the branch for tracker
148
157
        information.
149
158
        """
150
 
        tracker = bugtracker.UniqueIntegerBugTracker('xxx', 'http://bugs.com')
 
159
        tracker = bugtracker.UniqueIntegerBugTracker('xxx',
 
160
                'http://bugs.com/')
151
161
        self.assertIs(tracker, tracker.get('xxx', None))
152
162
        self.assertIs(None, tracker.get('yyy', None))
153
163
 
154
164
    def test_check_bug_id_only_accepts_integers(self):
155
165
        """A UniqueIntegerBugTracker accepts integers as bug IDs."""
156
 
        tracker = bugtracker.UniqueIntegerBugTracker('xxx', 'http://bugs.com')
 
166
        tracker = bugtracker.UniqueIntegerBugTracker('xxx',
 
167
                'http://bugs.com/')
157
168
        tracker.check_bug_id('1234')
158
169
 
159
170
    def test_check_bug_id_doesnt_accept_non_integers(self):
160
171
        """A UniqueIntegerBugTracker rejects non-integers as bug IDs."""
161
 
        tracker = bugtracker.UniqueIntegerBugTracker('xxx', 'http://bugs.com')
 
172
        tracker = bugtracker.UniqueIntegerBugTracker('xxx',
 
173
                'http://bugs.com/')
162
174
        self.assertRaises(
163
175
            errors.MalformedBugIdentifier, tracker.check_bug_id, 'red')
164
176