(self, getpass)
| 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) |
nothing calls this directly
no test coverage detected