MCPcopy Index your code
hub / github.com/pyinvoke/invoke / sudo_prompt_up_front

Method sudo_prompt_up_front

tests/program.py:1397–1413  ·  view source on GitHub ↗
(self, getpass)

Source from the content-addressed store, hash-verified

1395 class other_behavior:
1396 @patch("invoke.program.getpass.getpass")
1397 def sudo_prompt_up_front(self, getpass):
1398 getpass.return_value = "mypassword"
1399 # Task under test makes expectations re: sudo config (doesn't
1400 # actually even sudo, sudo's use of config is tested in Config
1401 # tests)
1402 with support_path():
1403 try:
1404 Program().run(
1405 "inv --prompt-for-sudo-password -c sudo_prompt expect-config" # noqa
1406 )
1407 except SystemExit as e:
1408 # If inner call failed, we'll already have seen its output,
1409 # and this will just ensure we ourselves are marked failed
1410 assert e.code == 0
1411 # Sanity check that getpass spat out desired prompt
1412 prompt = "Desired 'sudo.password' config value: "
1413 getpass.assert_called_once_with(prompt)

Callers

nothing calls this directly

Calls 3

support_pathFunction · 0.90
ProgramClass · 0.90
runMethod · 0.45

Tested by

no test coverage detected