~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ftp_transport.py

  • Committer: Vincent Ladeuil
  • Date: 2009-03-17 08:50:17 UTC
  • mto: (4167.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4168.
  • Revision ID: v.ladeuil+lp@free.fr-20090317085017-3z3rqqt7uku3sc22
Allows empty passwords with pyftpdlib ftp test server.

* bzrlib/tests/test_ftp_transport.py:
(TestFTPServerUI.test_no_prompt_for_password_when_using_auth_config):
Explicitly test empty password.

* bzrlib/tests/ftp_server/pyftpdlib_based.py:
(ftpserver.proto_cmds): Override PASS to allow empty passwords.

Show diffs side-by-side

added added

removed removed

Lines of Context:
108
108
        self.assertEqual('test bytes\n', t.get_bytes('foo'))
109
109
        # stdin should have  been left untouched
110
110
        self.assertEqual('precious\n', ui.ui_factory.stdin.readline())
 
111
 
 
112
    def test_empty_password(self):
 
113
        # Override the default user/password from setUp
 
114
        self.user = 'jim'
 
115
        self.password = ''
 
116
        self.get_server().add_user(self.user, self.password)
 
117
        t = self.get_transport()
 
118
        ui.ui_factory = tests.TestUIFactory(stdin=self.password+'\n',
 
119
                                            stdout=tests.StringIOWrapper())
 
120
        # Issue a request to the server to connect
 
121
        t.has('whatever/not/existing')
 
122
        # stdin should be empty (the provided password have been consumed),
 
123
        # even if the password is empty, it's followed by a newline.
 
124
        self.assertEqual('', ui.ui_factory.stdin.readline())
 
125