~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_sftp_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
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
 
18
import getpass
18
19
import os
19
20
import socket
20
21
import sys
33
34
    errors,
34
35
    tests,
35
36
    transport as _mod_transport,
 
37
    ui,
36
38
    )
37
39
from bzrlib.osutils import (
38
40
    pathjoin,
545
547
 
546
548
    def test_sftp_is_none_if_no_config(self):
547
549
        t = self.get_transport_for_connection(set_config=False)
548
 
        self.assertIs(None, t._get_credentials()[0])
 
550
        self.assertIs(getpass.getuser(), t._get_credentials()[0])
 
551
 
 
552
    def test_sftp_doesnt_prompt_username(self):
 
553
        stdout = tests.StringIOWrapper()
 
554
        ui.ui_factory = tests.TestUIFactory(stdin='joe\nfoo\n', stdout=stdout)
 
555
        t = self.get_transport_for_connection(set_config=False)
 
556
        self.assertIs(getpass.getuser(), t._get_credentials()[0])
 
557
        # No prompts should've been printed, stdin shouldn't have been read
 
558
        self.assertEquals("", stdout.getvalue())
 
559
        self.assertEquals(0, ui.ui_factory.stdin.tell())