Skip to content

Commit 7c83a08

Browse files
committed
Adding test case allow_agent
1 parent eb83981 commit 7c83a08

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_pssh_client.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,3 +690,29 @@ def test_host_config(self):
690690
msg="Host config pkey override failed")
691691
for (server, _) in servers:
692692
server.kill()
693+
694+
def test_pssh_client_override_allow_agent_authentication(self):
695+
"""Test running command with allow_agent set to False"""
696+
client = ParallelSSHClient([self.host], port=self.listen_port,
697+
pkey=self.user_key, allow_agent=False)
698+
output = client.run_command(self.fake_cmd)
699+
expected_exit_code = 0
700+
expected_stdout = [self.fake_resp]
701+
expected_stderr = []
702+
703+
stdout = list(output[self.host]['stdout'])
704+
stderr = list(output[self.host]['stderr'])
705+
exit_code = output[self.host]['exit_code']
706+
self.assertEqual(expected_exit_code, exit_code,
707+
msg="Got unexpected exit code - %s, expected %s" %
708+
(exit_code,
709+
expected_exit_code,))
710+
self.assertEqual(expected_stdout, stdout,
711+
msg="Got unexpected stdout - %s, expected %s" %
712+
(stdout,
713+
expected_stdout,))
714+
self.assertEqual(expected_stderr, stderr,
715+
msg="Got unexpected stderr - %s, expected %s" %
716+
(stderr,
717+
expected_stderr,))
718+
del client

0 commit comments

Comments
 (0)