~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bzrdir.py

Merge cleanup into first-try resolving conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1401
1401
        self.assertIsInstance(params, RepoInitHookParams)
1402
1402
        self.assertTrue(hasattr(params, 'bzrdir'))
1403
1403
        self.assertTrue(hasattr(params, 'repository'))
 
1404
 
 
1405
    def test_post_repo_init_hook_repr(self):
 
1406
        param_reprs = []
 
1407
        bzrdir.BzrDir.hooks.install_named_hook('post_repo_init',
 
1408
            lambda params: param_reprs.append(repr(params)), None)
 
1409
        self.make_repository('foo')
 
1410
        self.assertLength(1, param_reprs)
 
1411
        param_repr = param_reprs[0]
 
1412
        self.assertStartsWith(param_repr, '<RepoInitHookParams for ')
 
1413
 
 
1414
 
 
1415
class TestGenerateBackupName(TestCaseWithMemoryTransport):
 
1416
 
 
1417
    def setUp(self):
 
1418
        super(TestGenerateBackupName, self).setUp()
 
1419
        self._transport = get_transport(self.get_url())
 
1420
        bzrdir.BzrDir.create(self.get_url(),
 
1421
            possible_transports=[self._transport])
 
1422
        self._bzrdir = bzrdir.BzrDir.open_from_transport(self._transport)
 
1423
 
 
1424
    def test_new(self):
 
1425
        self.assertEqual("a.~1~", self._bzrdir.generate_backup_name("a"))
 
1426
 
 
1427
    def test_exiting(self):
 
1428
        self._transport.put_bytes("a.~1~", "some content")
 
1429
        self.assertEqual("a.~2~", self._bzrdir.generate_backup_name("a"))