547
547
transport = MemoryTransport()
548
548
client = FakeClient(transport.base)
549
549
reference_bzrdir_format = bzrdir.format_registry.get('default')()
550
branch_name = reference_bzrdir_format.get_branch_format().network_name()
550
551
client.add_success_response_with_body(
551
552
bencode.bencode({
553
"branch", reference_bzrdir_format.get_branch_format().network_name()),
554
"": ("ref", "")}), "success")
553
"foo": ("branch", branch_name),
554
"": ("branch", branch_name)}), "success")
555
client.add_success_response(
556
'ok', '', 'no', 'no', 'no',
557
reference_bzrdir_format.repository_format.network_name())
558
client.add_error_response('NotStacked')
559
client.add_success_response(
560
'ok', '', 'no', 'no', 'no',
561
reference_bzrdir_format.repository_format.network_name())
562
client.add_error_response('NotStacked')
555
563
transport.mkdir('quack')
556
564
transport = transport.clone('quack')
557
565
a_bzrdir = RemoteBzrDir(transport, RemoteBzrDirFormat(),
559
567
result = a_bzrdir.get_branches()
560
568
self.assertEquals(["", "foo"], result.keys())
561
569
self.assertEqual(
562
[('call', 'BzrDir.get_branches', ('quack/',))],
570
[('call_expecting_body', 'BzrDir.get_branches', ('quack/',)),
571
('call', 'BzrDir.find_repositoryV3', ('quack/', )),
572
('call', 'Branch.get_stacked_on_url', ('quack/', )),
573
('call', 'BzrDir.find_repositoryV3', ('quack/', )),
574
('call', 'Branch.get_stacked_on_url', ('quack/', ))],