/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/blackbox/test_serve.py

  • Committer: Robert Collins
  • Date: 2009-09-17 11:54:41 UTC
  • mto: This revision was merged to the branch mainline in revision 4700.
  • Revision ID: robertc@robertcollins.net-20090917115441-2ug57z6eyrnb6zim
Add stronger test isolation by interception BzrDir.open and checking the thing being opened is known to the test suite.

Show diffs side-by-side

added added

removed removed

Lines of Context:
85
85
        # We use this url because while this is no valid URL to connect to this
86
86
        # server instance, the transport needs a URL.
87
87
        url = 'bzr://localhost/'
 
88
        self.permit_url(url)
88
89
        client_medium = medium.SmartSimplePipesClientMedium(
89
90
            process.stdout, process.stdin, url)
90
91
        transport = remote.RemoteTransport(url, medium=client_medium)
105
106
        prefix = 'listening on port: '
106
107
        self.assertStartsWith(port_line, prefix)
107
108
        port = int(port_line[len(prefix):])
108
 
        return process,'bzr://localhost:%d/' % port
 
109
        url = 'bzr://localhost:%d/' % port
 
110
        self.permit_url(url)
 
111
        return process, url
109
112
 
110
113
    def test_bzr_serve_inet_readonly(self):
111
114
        """bzr server should provide a read only filesystem by default."""
160
163
        bzr+ssh:// should cause bzr to run a remote bzr smart server over SSH.
161
164
        """
162
165
        try:
163
 
            from bzrlib.transport.sftp import SFTPServer
 
166
            # SFTPFullAbsoluteServer has a get_url method, and doesn't
 
167
            # override the interface (doesn't change self._vendor).
 
168
            from bzrlib.transport.sftp import SFTPFullAbsoluteServer
164
169
        except ParamikoNotPresent:
165
170
            raise TestSkipped('Paramiko not installed')
166
171
        from bzrlib.tests.stub_sftp import StubServer
206
211
 
207
212
                return True
208
213
 
209
 
        ssh_server = SFTPServer(StubSSHServer)
 
214
        ssh_server = SFTPFullAbsoluteServer(StubSSHServer)
210
215
        # XXX: We *don't* want to override the default SSH vendor, so we set
211
216
        # _vendor to what _get_ssh_vendor returns.
212
217
        self.start_server(ssh_server)
224
229
        try:
225
230
            if sys.platform == 'win32':
226
231
                path_to_branch = os.path.splitdrive(path_to_branch)[1]
227
 
            branch = Branch.open(
228
 
                'bzr+ssh://fred:secret@localhost:%d%s' % (port, path_to_branch))
 
232
            url_suffix = '@localhost:%d%s' % (port, path_to_branch)
 
233
            self.permit_url('bzr+ssh://fred' + url_suffix)
 
234
            branch = Branch.open('bzr+ssh://fred:secret' + url_suffix)
229
235
            self.make_read_requests(branch)
230
236
            # Check we can perform write operations
231
237
            branch.bzrdir.root_transport.mkdir('foo')