~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bugtracker.py

  • Committer: Martin Albisetti
  • Date: 2008-05-06 00:21:18 UTC
  • mto: (3431.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 3432.
  • Revision ID: argentina@gmail.com-20080506002118-7w9ywklw4khddf3g
Added spanish index

Show diffs side-by-side

added added

removed removed

Lines of Context:
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
16
 
17
17
 
18
18
from bzrlib import bugtracker, errors, urlutils
19
 
from bzrlib.tests import TestCase, TestCaseWithMemoryTransport
 
19
from bzrlib.tests import TestCaseWithMemoryTransport
20
20
 
21
21
 
22
22
class TestGetBugURL(TestCaseWithMemoryTransport):
41
41
        self.tracker_type = TestGetBugURL.TransientTracker
42
42
        self.tracker_type.log = []
43
43
        bugtracker.tracker_registry.register('transient', self.tracker_type)
44
 
        self.addCleanup(bugtracker.tracker_registry.remove, 'transient')
 
44
        self.addCleanup(lambda:
 
45
                        bugtracker.tracker_registry.remove('transient'))
45
46
 
46
47
    def test_get_bug_url_for_transient_tracker(self):
47
48
        branch = self.make_branch('some_branch')
193
194
        """If asked for a valid tag, return a tracker instance that can map bug
194
195
        IDs to <base_url>/<bug_area> + <bug_id>."""
195
196
        bugtracker.tracker_registry.register('some', self.tracker)
196
 
        self.addCleanup(bugtracker.tracker_registry.remove, 'some')
 
197
        self.addCleanup(lambda: bugtracker.tracker_registry.remove('some'))
197
198
 
198
199
        branch = self.make_branch('some_branch')
199
200
        config = branch.get_config()
209
210
        """
210
211
        self.assertRaises(
211
212
            errors.MalformedBugIdentifier, self.tracker.get_bug_url, 'bad')
212
 
 
213
 
 
214
 
class TestPropertyEncoding(TestCase):
215
 
    """Tests for how the bug URLs are encoded as revision properties."""
216
 
 
217
 
    def test_encoding_one(self):
218
 
        self.assertEqual(
219
 
            'http://example.com/bugs/1 fixed',
220
 
            bugtracker.encode_fixes_bug_urls(['http://example.com/bugs/1']))
221
 
 
222
 
    def test_encoding_zero(self):
223
 
        self.assertEqual('', bugtracker.encode_fixes_bug_urls([]))
224
 
 
225
 
    def test_encoding_two(self):
226
 
        self.assertEqual(
227
 
            'http://example.com/bugs/1 fixed\n'
228
 
            'http://example.com/bugs/2 fixed',
229
 
            bugtracker.encode_fixes_bug_urls(
230
 
                ['http://example.com/bugs/1', 'http://example.com/bugs/2']))