458
459
self.assertEqual(expected, request.execute(''))
462
class TestSmartServerBzrDirRequestGetBranches(
463
tests.TestCaseWithMemoryTransport):
464
"""Tests for BzrDir.get_branches."""
466
def test_simple(self):
467
backing = self.get_transport()
468
branch = self.make_branch('.')
469
request_class = smart_dir.SmartServerBzrDirRequestGetBranches
470
request = request_class(backing)
471
local_result = bencode.bencode(
472
{"": ("branch", branch._format.network_name())})
473
expected = smart_req.SuccessfulSmartServerResponse(
474
("success", ), local_result)
475
self.assertEqual(expected, request.execute(''))
477
def test_empty(self):
478
backing = self.get_transport()
479
dir = self.make_bzrdir('.')
480
request_class = smart_dir.SmartServerBzrDirRequestGetBranches
481
request = request_class(backing)
482
local_result = bencode.bencode({})
483
expected = smart_req.SuccessfulSmartServerResponse(
484
('success',), local_result)
485
self.assertEqual(expected, request.execute(''))
461
488
class TestSmartServerRequestInitializeBzrDir(tests.TestCaseWithMemoryTransport):
463
490
def test_empty_dir(self):
485
512
backing = self.get_transport()
486
513
request = smart_dir.SmartServerRequestInitializeBzrDir(backing)
487
514
self.make_bzrdir('subdir')
488
self.assertRaises(errors.FileExists,
515
self.assertRaises(errors.AlreadyControlDirError,
489
516
request.execute, 'subdir')
2500
2527
smart_dir.SmartServerBzrDirRequestCheckoutMetaDir)
2501
2528
self.assertHandlerEqual('BzrDir.cloning_metadir',
2502
2529
smart_dir.SmartServerBzrDirRequestCloningMetaDir)
2530
self.assertHandlerEqual('BzrDir.get_branches',
2531
smart_dir.SmartServerBzrDirRequestGetBranches)
2503
2532
self.assertHandlerEqual('BzrDir.get_config_file',
2504
2533
smart_dir.SmartServerBzrDirRequestConfigFile)
2505
2534
self.assertHandlerEqual('BzrDir.open_branch',