cmds queue test on real terminal
@@ -4,7 +4,7 @@ Tests for connection shell
"""
__author__ = 'Marcin Usielski, Michal Ernst'
-__copyright__ = 'Copyright (C) 2018, Nokia'
+__copyright__ = 'Copyright (C) 2018-2019, Nokia'
__email__ = 'marcin.usielski@nokia.com, michal.ernst@nokia.com'
import getpass
@@ -18,6 +18,23 @@ from moler.exceptions import CommandTimeout
from moler.io.raw.terminal import ThreadedTerminal
+def test_terminal_cmd_whoami_during_ping(terminal_connection):
+ terminal = terminal_connection
+ cmd_whoami = Whoami(connection=terminal)
+ cmd_ping = Ping(connection=terminal, destination="127.0.0.1", options='-c 3')
+ cmd_ping.start(timeout=3)
+ cmd_whoami.start(timeout=5)
+ ret_whoami = cmd_whoami.await_done(timeout=5)
+ assert 'USER' in ret_whoami
+ assert ret_whoami['USER'] is not None
+ assert getpass.getuser() == ret_whoami['USER']
+ ret_ping = cmd_ping.result()
+ assert 'packets_transmitted' in ret_ping
+ assert 3 == int(ret_ping['packets_transmitted'])
+ assert 'packet_loss' in ret_ping
+ assert 0 == int(ret_ping['packet_loss'])
+
+
def test_terminal_cmd_whoami(terminal_connection):
terminal = terminal_connection
cmd = Whoami(connection=terminal)
