Skip to content

Commit

Permalink
Add more unit tests for wsman.py module
Browse files Browse the repository at this point in the history
Signed-off-by: Mihaela Balutoiu <[email protected]>
  • Loading branch information
mihaelabalutoiu authored and Dany9966 committed Mar 26, 2024
1 parent 75f6c39 commit 7296019
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions coriolis/tests/test_wsman.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,14 @@ def test__exec_command_exception(self):
mock.ANY, mock.ANY)
self.conn._protocol.close_shell.assert_called_once_with(mock.ANY)

def test__exec_command_invalid_credentials(self):
self.conn._protocol.open_shell.side_effect = (
wsman.winrm_exceptions.InvalidCredentialsError)

self.assertRaises(exception.NotAuthorized, self.conn._exec_command,
self.cmd, self.args)
self.conn._protocol.close_shell.assert_not_called()

def test_exec_command(self):
self.conn._protocol.get_command_output.return_value = (
"std_out", "std_err", 0)
Expand Down

0 comments on commit 7296019

Please sign in to comment.