Esempio n. 1
0
 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))
Esempio n. 2
0
 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))
Esempio n. 3
0
 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))
Esempio n. 4
0
 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))
Esempio n. 5
0
 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))
Esempio n. 6
0
 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))
Esempio n. 7
0
 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))
Esempio n. 8
0
 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))