~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-02-10 15:46:03 UTC
  • mfrom: (4985.3.21 update)
  • mto: This revision was merged to the branch mainline in revision 5021.
  • Revision ID: v.ladeuil+lp@free.fr-20100210154603-k4no1gvfuqpzrw7p
Update performs two merges in a more logical order but stop on conflicts

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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
18
from bzrlib import bugtracker, errors, urlutils
19
 
from bzrlib.tests import TestCaseWithMemoryTransport
 
19
from bzrlib.tests import TestCase, 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(lambda:
45
 
                        bugtracker.tracker_registry.remove('transient'))
 
44
        self.addCleanup(bugtracker.tracker_registry.remove, 'transient')
46
45
 
47
46
    def test_get_bug_url_for_transient_tracker(self):
48
47
        branch = self.make_branch('some_branch')
194
193
        """If asked for a valid tag, return a tracker instance that can map bug
195
194
        IDs to <base_url>/<bug_area> + <bug_id>."""
196
195
        bugtracker.tracker_registry.register('some', self.tracker)
197
 
        self.addCleanup(lambda: bugtracker.tracker_registry.remove('some'))
 
196
        self.addCleanup(bugtracker.tracker_registry.remove, 'some')
198
197
 
199
198
        branch = self.make_branch('some_branch')
200
199
        config = branch.get_config()
210
209
        """
211
210
        self.assertRaises(
212
211
            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']))