~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/ftp_server/pyftpdlib_based.py

  • Committer: Andrew Bennetts
  • Date: 2010-01-13 23:16:20 UTC
  • mfrom: (4957 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4960.
  • Revision ID: andrew.bennetts@canonical.com-20100113231620-n6in2yjib2v6z03g
MergeĀ lp:bzr.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
 
51
51
    def listdir(self, path):
52
52
        """List the content of a directory."""
53
 
        # FIXME: need tests with unicode paths
54
53
        return [osutils.safe_utf8(s) for s in os.listdir(path)]
55
54
 
56
55
    def fs2ftp(self, fspath):
57
 
        p = ftpserver.AbstractedFS.fs2ftp(self, fspath)
58
 
        # FIXME: need tests with unicode paths
 
56
        p = ftpserver.AbstractedFS.fs2ftp(self, osutils.safe_unicode(fspath))
59
57
        return osutils.safe_utf8(p)
60
58
 
 
59
    def ftp2fs(self, ftppath):
 
60
        p = osutils.safe_unicode(ftppath)
 
61
        return ftpserver.AbstractedFS.ftp2fs(self, p)
61
62
 
62
63
class BzrConformingFTPHandler(ftpserver.FTPHandler):
63
64
 
156
157
        """This is used by ftp_server to log connections, etc."""
157
158
        self.logs.append(message)
158
159
 
159
 
    def setUp(self, vfs_server=None):
 
160
    def start_server(self, vfs_server=None):
160
161
        from bzrlib.transport.local import LocalURLServer
161
162
        if not (vfs_server is None or isinstance(vfs_server, LocalURLServer)):
162
163
            raise AssertionError(
186
187
        self._ftpd_starting.acquire()
187
188
        self._ftpd_starting.release()
188
189
 
189
 
    def tearDown(self):
190
 
        """See bzrlib.transport.Server.tearDown."""
 
190
    def stop_server(self):
 
191
        """See bzrlib.transport.Server.stop_server."""
191
192
        # Tell the server to stop, but also close the server socket for tests
192
193
        # that start the server but never initiate a connection. Closing the
193
194
        # socket should be done first though, to avoid further connections.
196
197
        self._ftpd_thread.join()
197
198
 
198
199
    def _run_server(self):
199
 
        """Run the server until tearDown is called, shut it down properly then.
 
200
        """Run the server until stop_server is called, shut it down properly then.
200
201
        """
201
202
        self._ftpd_running = True
202
203
        self._ftpd_starting.release()