forked from TrueCloudLab/frostfs-testcases
[#334] Move common_steps*
Signed-off-by: Elizaveta Chichindaeva <elizaveta@nspcc.ru>
This commit is contained in:
parent
26f98c2cab
commit
18c30c39ff
69 changed files with 256 additions and 263 deletions
23
robot/resources/lib/python/cli_keywords.py
Normal file
23
robot/resources/lib/python/cli_keywords.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/python3.8
|
||||
|
||||
import pexpect
|
||||
|
||||
from robot.api.deco import keyword
|
||||
|
||||
ROBOT_AUTO_KEYWORDS = False
|
||||
|
||||
@keyword('Run Process And Enter Empty Password')
|
||||
def run_proccess_and_interact(cmd: str) -> str:
|
||||
p = pexpect.spawn(cmd)
|
||||
p.expect("[pP]assword")
|
||||
# enter empty password
|
||||
p.sendline('\r')
|
||||
p.wait()
|
||||
# throw a string with password prompt
|
||||
first = p.readline()
|
||||
# take all output
|
||||
child_output = p.readline()
|
||||
p.close()
|
||||
if p.exitstatus != 0:
|
||||
raise Exception(f"{first}\n{child_output}")
|
||||
return child_output
|
Loading…
Add table
Add a link
Reference in a new issue