Permalink
Browse files

Merge branch '1.4'

  • Loading branch information...
bitprophet committed Apr 24, 2012
2 parents 08c5a6a + 8fc6369 commit a6f229bbbe7aee042fad096204ba2706126065cd
Showing with 20 additions and 14 deletions.
  1. +3 −0 docs/changelog.rst
  2. +17 −14 tests/test_network.py
View
@@ -25,6 +25,9 @@ would have also been included in the 1.2 line.
Changelog
=========
+* :bug:`624` Login password prompts did not always display the username being
+ authenticated for. This has been fixed. Thanks to Nick Zalutskiy for catch &
+ patch.
* :bug:`617` Fix the ``clean_revert`` behavior of
`~fabric.context_managers.settings` so it doesn't ``KeyError`` for newly
created settings keys. Thanks to Chris Streeter for the catch.
View
@@ -282,7 +282,7 @@ def test_password_prompt_displays_host_string(self):
output.everything = False
with password_response(PASSWORDS[env.user], silent=False):
run("ls /simple")
- regex = r'^\[%s\] Login password: ' % env.host_string
+ regex = r'^\[%s\] Login password for \'%s\': ' % (env.host_string, env.user)
assert_contains(regex, sys.stderr.getvalue())
@mock_streams('stderr')
@@ -297,7 +297,7 @@ def test_passphrase_prompt_displays_host_string(self):
output.everything = False
with password_response(CLIENT_PRIVKEY_PASSPHRASE, silent=False):
run("ls /simple")
- regex = r'^\[%s\] Login password: ' % env.host_string
+ regex = r'^\[%s\] Login password for \'%s\': ' % (env.host_string, env.user)
assert_contains(regex, sys.stderr.getvalue())
def test_sudo_prompt_display_passthrough(self):
@@ -328,20 +328,23 @@ def _prompt_display(display_output):
if display_output:
expected = """
[%(prefix)s] sudo: oneliner
-[%(prefix)s] Login password:
+[%(prefix)s] Login password for '%(user)s':
[%(prefix)s] out: sudo password:
[%(prefix)s] out: Sorry, try again.
[%(prefix)s] out: sudo password:
[%(prefix)s] out: result
-""" % {'prefix': env.host_string}
+""" % {'prefix': env.host_string, 'user': env.user}
else:
# Note lack of first sudo prompt (as it's autoresponded to) and of
# course the actual result output.
expected = """
[%(prefix)s] sudo: oneliner
-[%(prefix)s] Login password:
+[%(prefix)s] Login password for '%(user)s':
[%(prefix)s] out: Sorry, try again.
-[%(prefix)s] out: sudo password: """ % {'prefix': env.host_string}
+[%(prefix)s] out: sudo password: """ % {
+ 'prefix': env.host_string,
+ 'user': env.user
+}
eq_(expected[1:], sys.stdall.getvalue())
@mock_streams('both')
@@ -364,7 +367,7 @@ def test_consecutive_sudos_should_not_have_blank_line(self):
sudo('twoliner')
expected = """
[%(prefix)s] sudo: oneliner
-[%(prefix)s] Login password:
+[%(prefix)s] Login password for '%(user)s':
[%(prefix)s] out: sudo password:
[%(prefix)s] out: Sorry, try again.
[%(prefix)s] out: sudo password:
@@ -373,7 +376,7 @@ def test_consecutive_sudos_should_not_have_blank_line(self):
[%(prefix)s] out: sudo password:
[%(prefix)s] out: result1
[%(prefix)s] out: result2
-""" % {'prefix': env.host_string}
+""" % {'prefix': env.host_string, 'user': env.user}
eq_(expected[1:], sys.stdall.getvalue())
@mock_streams('both')
@@ -400,12 +403,12 @@ def test_silent_commands_should_not_have_blank_line(self):
run('silent')
expected = """
[%(prefix)s] run: normal
-[%(prefix)s] Login password:
+[%(prefix)s] Login password for '%(user)s':
[%(prefix)s] out: foo
[%(prefix)s] run: silent
[%(prefix)s] run: normal
[%(prefix)s] out: foo
-""" % {'prefix': env.host_string}
+""" % {'prefix': env.host_string, 'user': env.user}
eq_(expected[1:], sys.stdall.getvalue())
@mock_streams('both')
@@ -428,12 +431,12 @@ def test_io_should_print_prefix_if_ouput_prefix_is_true(self):
run('twoliner')
expected = """
[%(prefix)s] run: oneliner
-[%(prefix)s] Login password:
+[%(prefix)s] Login password for '%(user)s':
[%(prefix)s] out: result
[%(prefix)s] run: twoliner
[%(prefix)s] out: result1
[%(prefix)s] out: result2
-""" % {'prefix': env.host_string}
+""" % {'prefix': env.host_string, 'user': env.user}
eq_(expected[1:], sys.stdall.getvalue())
@mock_streams('both')
@@ -457,12 +460,12 @@ def test_io_should_not_print_prefix_if_ouput_prefix_is_false(self):
run('twoliner')
expected = """
[%(prefix)s] run: oneliner
-[%(prefix)s] Login password:
+[%(prefix)s] Login password for '%(user)s':
result
[%(prefix)s] run: twoliner
result1
result2
-""" % {'prefix': env.host_string}
+""" % {'prefix': env.host_string, 'user': env.user}
eq_(expected[1:], sys.stdall.getvalue())

0 comments on commit a6f229b

Please sign in to comment.