|
@@ -55,7 +55,8 @@ class TestSetupAgent(TestCase):
|
|
|
@patch.object(setup_agent, 'execOsCommand')
|
|
|
@patch("os.environ")
|
|
|
@patch("subprocess.call")
|
|
|
- def test_runAgent(self, call_mock, environ_mock, execOsCommand_mock):
|
|
|
+ @patch("time.sleep")
|
|
|
+ def test_runAgent(self, sleep_mock, call_mock, environ_mock, execOsCommand_mock):
|
|
|
expected_hostname = "test.hst"
|
|
|
passphrase = "passphrase"
|
|
|
call_mock.return_value = 0
|
|
@@ -65,6 +66,7 @@ class TestSetupAgent(TestCase):
|
|
|
cmdStr = str(call_mock.call_args_list[0][0])
|
|
|
self.assertTrue(expected_hostname in cmdStr)
|
|
|
self.assertEqual(ret, 0)
|
|
|
+ self.assertTrue(sleep_mock.called)
|
|
|
# Key 'log' not found
|
|
|
execOsCommand_mock.return_value = None
|
|
|
ret = setup_agent.runAgent(passphrase, expected_hostname)
|