~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

  • Committer: Vincent Ladeuil
  • Date: 2012-02-14 17:22:37 UTC
  • mfrom: (6466 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6468.
  • Revision ID: v.ladeuil+lp@free.fr-20120214172237-7dv7er3n4uy8d5m4
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
import zlib
29
29
 
30
30
from bzrlib import (
 
31
    bencode,
31
32
    branch,
32
33
    bzrdir,
33
34
    config,
34
35
    controldir,
35
36
    errors,
36
 
    graph as _mod_graph,
37
37
    inventory,
38
38
    inventory_delta,
39
39
    remote,
541
541
        self.assertFinished(client)
542
542
 
543
543
 
 
544
class TestBzrDirGetBranches(TestRemote):
 
545
 
 
546
    def test_get_branches(self):
 
547
        transport = MemoryTransport()
 
548
        client = FakeClient(transport.base)
 
549
        reference_bzrdir_format = bzrdir.format_registry.get('default')()
 
550
        branch_name = reference_bzrdir_format.get_branch_format().network_name()
 
551
        client.add_success_response_with_body(
 
552
            bencode.bencode({
 
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')
 
563
        transport.mkdir('quack')
 
564
        transport = transport.clone('quack')
 
565
        a_bzrdir = RemoteBzrDir(transport, RemoteBzrDirFormat(),
 
566
            _client=client)
 
567
        result = a_bzrdir.get_branches()
 
568
        self.assertEquals(["", "foo"], result.keys())
 
569
        self.assertEqual(
 
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/', ))],
 
575
            client._calls)
 
576
 
 
577
 
544
578
class TestBzrDirDestroyBranch(TestRemote):
545
579
 
546
580
    def test_destroy_default(self):
555
589
        a_bzrdir.destroy_branch()
556
590
        self.assertFinished(client)
557
591
 
558
 
    def test_destroy_named(self):
559
 
        transport = self.get_transport('quack')
560
 
        referenced = self.make_branch('referenced')
561
 
        client = FakeClient(transport.base)
562
 
        client.add_expected_call(
563
 
            'BzrDir.destroy_branch', ('quack/', "foo"),
564
 
            'success', ('ok',)),
565
 
        a_bzrdir = RemoteBzrDir(transport, RemoteBzrDirFormat(),
566
 
            _client=client)
567
 
        a_bzrdir.destroy_branch("foo")
568
 
        self.assertFinished(client)
569
 
 
570
592
 
571
593
class TestBzrDirHasWorkingTree(TestRemote):
572
594