Преглед изворни кода

Add more unit tests for `wsman.py` module

Signed-off-by: Mihaela Balutoiu <mbalutoiu@cloudbasesolutions.com>
Mihaela Balutoiu пре 2 година
родитељ
комит
72960196be
1 измењених фајлова са 8 додато и 0 уклоњено
  1. 8 0
      coriolis/tests/test_wsman.py

+ 8 - 0
coriolis/tests/test_wsman.py

@@ -122,6 +122,14 @@ class WSManConnectionTestCase(test_base.CoriolisBaseTestCase):
             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)