~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_ftp_transport.py

  • Committer: Robert J. Tanner
  • Date: 2009-04-20 08:37:32 UTC
  • mfrom: (4299 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4300.
  • Revision ID: tanner@real-time.com-20090420083732-bzx919oo7wpmqc2u
[merge] 1.14rc2 back into bzr.dev (Bob Tanner)

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
from cStringIO import StringIO
 
18
import getpass
18
19
import sys
19
20
 
20
21
from bzrlib import (
84
85
            scheme, self.user, self.password, host, port, path)
85
86
        return url
86
87
 
 
88
    def test_no_prompt_for_username(self):
 
89
        """ensure getpass.getuser() is used if there's no username in the 
 
90
        configuration.""",
 
91
        self.get_server().add_user(getpass.getuser(), self.password)
 
92
        t = self.get_transport()
 
93
        ui.ui_factory = tests.TestUIFactory(stdin=self.password + '\n',
 
94
                                            stdout=tests.StringIOWrapper())
 
95
        # Issue a request to the server to connect
 
96
        t.put_bytes('foo', 'test bytes\n')
 
97
        self.assertEqual('test bytes\n', t.get_bytes('foo'))
 
98
        # Only the password should've been read
 
99
        self.assertEqual('', ui.ui_factory.stdin.readline())
 
100
 
87
101
    def test_prompt_for_password(self):
88
102
        t = self.get_transport()
89
103
        ui.ui_factory = tests.TestUIFactory(stdin=self.password+'\n',