/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_remote.py

  • Committer: Vincent Ladeuil
  • Date: 2011-03-14 10:11:58 UTC
  • mfrom: (5609.24.1 2.3)
  • mto: (5609.24.2 2.3)
  • mto: This revision was merged to the branch mainline in revision 5723.
  • Revision ID: v.ladeuil+lp@free.fr-20110314101158-9ojis0ftsljg3c3t
Merge bzr/2.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
61
61
from bzrlib.smart.client import _SmartClient
62
62
from bzrlib.smart.repository import SmartServerRepositoryGetParentMap
63
63
from bzrlib.tests import (
64
 
    condition_isinstance,
65
 
    multiply_tests,
66
64
    test_server,
67
65
    )
68
66
from bzrlib.tests.scenarios import load_tests_apply_scenarios
71
69
    RemoteTransport,
72
70
    RemoteSSHTransport,
73
71
    RemoteTCPTransport,
74
 
)
 
72
    )
75
73
 
76
74
 
77
75
load_tests = load_tests_apply_scenarios
723
721
        format = branch._format
724
722
        self.assertEqual(network_name, format.network_name())
725
723
 
 
724
    def test_already_open_repo_and_reused_medium(self):
 
725
        """Bug 726584: create_branch(..., repository=repo) should work
 
726
        regardless of what the smart medium's base URL is.
 
727
        """
 
728
        self.transport_server = test_server.SmartTCPServer_for_testing
 
729
        transport = self.get_transport('.')
 
730
        repo = self.make_repository('quack')
 
731
        # Client's medium rooted a transport root (not at the bzrdir)
 
732
        client = FakeClient(transport.base)
 
733
        transport = transport.clone('quack')
 
734
        reference_bzrdir_format = bzrdir.format_registry.get('default')()
 
735
        reference_format = reference_bzrdir_format.get_branch_format()
 
736
        network_name = reference_format.network_name()
 
737
        reference_repo_fmt = reference_bzrdir_format.repository_format
 
738
        reference_repo_name = reference_repo_fmt.network_name()
 
739
        client.add_expected_call(
 
740
            'BzrDir.create_branch', ('extra/quack/', network_name),
 
741
            'success', ('ok', network_name, '', 'no', 'no', 'yes',
 
742
            reference_repo_name))
 
743
        a_bzrdir = RemoteBzrDir(transport, remote.RemoteBzrDirFormat(),
 
744
            _client=client)
 
745
        branch = a_bzrdir.create_branch(repository=repo)
 
746
        # We should have got a remote branch
 
747
        self.assertIsInstance(branch, remote.RemoteBranch)
 
748
        # its format should have the settings from the response
 
749
        format = branch._format
 
750
        self.assertEqual(network_name, format.network_name())
 
751
 
726
752
 
727
753
class TestBzrDirCreateRepository(TestRemote):
728
754