def test_reset_syslog_config_params_success(self): ''' Tests function returns True when the esxxli function returns a successful retcode. ''' valid_resets = ['hello', 'world'] ret = {'success': True, 'hello': {'success': True}, 'world': {'success': True}} self.assertDictEqual(ret, vsphere._reset_syslog_config_params(HOST, USER, PASSWORD, 'cmd', valid_resets, valid_resets))
def test_reset_syslog_config_params_success(self): ''' Tests function returns True when the esxxli function returns a successful retcode. ''' valid_resets = ['hello', 'world'] ret = {'success': True, 'hello': {'success': True}, 'world': {'success': True}} self.assertDictEqual(ret, vsphere._reset_syslog_config_params(HOST, USER, PASSWORD, 'cmd', valid_resets, valid_resets))
def test_reset_syslog_config_params_error(self): ''' Tests function returns False when the esxxli function returns an unsuccessful retcode. ''' valid_resets = ['hello', 'world'] error_dict = {'success': False, 'message': ERROR} ret = {'success': False, 'hello': error_dict, 'world': error_dict} self.assertDictEqual(ret, vsphere._reset_syslog_config_params(HOST, USER, PASSWORD, 'cmd', valid_resets, valid_resets))
def test_reset_syslog_config_params_no_valid_reset(self): ''' Tests function returns False when an invalid syslog config is passed. ''' valid_resets = ['hello', 'world'] config = 'foo' ret = {'success': False, config: {'success': False, 'message': 'Invalid syslog configuration parameter'}} self.assertEqual(ret, vsphere._reset_syslog_config_params(HOST, USER, PASSWORD, 'cmd', config, valid_resets))
def test_reset_syslog_config_params_success(self): ''' Tests function returns True when the esxxli function returns a successful retcode. ''' with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 0})): valid_resets = ['hello', 'world'] ret = {'success': True, 'hello': {'success': True}, 'world': {'success': True}} self.assertDictEqual(ret, vsphere._reset_syslog_config_params(HOST, USER, PASSWORD, 'cmd', valid_resets, valid_resets))
def test_reset_syslog_config_params_error(self): ''' Tests function returns False when the esxxli function returns an unsuccessful retcode. ''' valid_resets = ['hello', 'world'] error_dict = {'success': False, 'message': ERROR} ret = {'success': False, 'hello': error_dict, 'world': error_dict} self.assertDictEqual(ret, vsphere._reset_syslog_config_params(HOST, USER, PASSWORD, 'cmd', valid_resets, valid_resets))
def test_reset_syslog_config_params_no_valid_reset(self): ''' Tests function returns False when an invalid syslog config is passed. ''' valid_resets = ['hello', 'world'] config = 'foo' ret = {'success': False, config: {'success': False, 'message': 'Invalid syslog configuration parameter'}} self.assertEqual(ret, vsphere._reset_syslog_config_params(HOST, USER, PASSWORD, 'cmd', config, valid_resets))
def test_reset_syslog_config_params_error(self): ''' Tests function returns False when the esxxli function returns an unsuccessful retcode. ''' with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 1, 'stdout': ERROR})): valid_resets = ['hello', 'world'] error_dict = {'success': False, 'message': ERROR} ret = {'success': False, 'hello': error_dict, 'world': error_dict} self.assertDictEqual(ret, vsphere._reset_syslog_config_params(HOST, USER, PASSWORD, 'cmd', valid_resets, valid_resets))