def test_wait_for_startup_error(self): ''' Test wait_for_startup method ''' mock_cmd_run = MagicMock(return_value=True) with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}): with pytest.raises(exceptions.SaltInvocationError) as err: crmshmod.wait_for_startup(5.0) assert 'timeout must be integer type' in str(err)
def test_wait_for_startup_timeout(self): ''' Test wait_for_startup method ''' mock_cmd_run = MagicMock(return_value=True) with patch.dict(crmshmod.__salt__, {'cmd.retcode': mock_cmd_run}): result = crmshmod.wait_for_startup(5) assert result mock_cmd_run.assert_called_once_with( '{crm_command} cluster wait_for_startup {timeout}'.format( crm_command=crmshmod.CRM_COMMAND, timeout=5))