Debian Codegraph @

test/integration/targets/cli/test_k_and_K.py

raw ◀ ▶
1 Debian patch touch this file
•1 #!/usr/bin/env python3
2 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
3
4 from __future__ import annotations
5
6 import os
7 import sys
8
9 import pexpect
10
11 os.environ['ANSIBLE_NOCOLOR'] = '1'
12
13 out = pexpect.run(
14 'ansible -c ssh -i localhost, -u cliuser1 -e ansible_python_interpreter={0} '
15 '-m command -a whoami -Kkb --become-user cliuser2 localhost'.format(sys.argv[1]),
16 events={
17 'SSH password:': 'secretpassword\n',
18 'BECOME password': 'secretpassword\n',
19 },
20 timeout=10
21 )
22
23 print(out)
24
25 assert b'cliuser2' in out