~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Andrew Bennetts
  • Date: 2009-07-27 05:35:00 UTC
  • mfrom: (4570 +trunk)
  • mto: (4634.6.29 2.0)
  • mto: This revision was merged to the branch mainline in revision 4680.
  • Revision ID: andrew.bennetts@canonical.com-20090727053500-q76zsn2dx33jhmj5
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2007 Canonical Ltd
 
1
# Copyright (C) 2007, 2008, 2009 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
12
12
#
13
13
# You should have received a copy of the GNU General Public License
14
14
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
"""
17
17
FTP test server.
18
18
 
210
210
        trace.mutter('ftp_server %s: %s', type, message)
211
211
 
212
212
 
213
 
class FTPServer(transport.Server):
 
213
class FTPTestServer(transport.Server):
214
214
    """Common code for FTP server facilities."""
215
215
 
216
216
    def __init__(self):
250
250
        # Don't let it loop forever, or handle an infinite number of requests.
251
251
        # In this case it will run for 1000s, or 10000 requests
252
252
        self._async_thread = threading.Thread(
253
 
                target=FTPServer._asyncore_loop_ignore_EBADF,
 
253
                target=FTPTestServer._asyncore_loop_ignore_EBADF,
254
254
                kwargs={'timeout':0.1, 'count':10000})
255
255
        self._async_thread.setDaemon(True)
256
256
        self._async_thread.start()
279
279
            if e.args[0] != errno.EBADF:
280
280
                raise
281
281
 
282
 
 
283
 
 
 
282
    def add_user(self, user, password):
 
283
        """Add a user with write access."""
 
284
        authorizer = server = self._ftp_server.authorizer
 
285
        authorizer.secured_user = user
 
286
        authorizer.secured_password = password
284
287