Beispiel #1
0
 def test_set_syslog_config_helper_success(self):
     '''
     Tests successful function return.
     '''
     config = 'logdir'
     self.assertEqual({config: {'success': True}},
                      vsphere._set_syslog_config_helper(HOST, USER, PASSWORD, config, 'foo'))
Beispiel #2
0
 def test_set_syslog_config_helper_no_valid_reset(self):
     '''
     Tests function returns False when an invalid syslog config is passed.
     '''
     config = 'foo'
     ret = {'success': False, 'message': '\'{0}\' is not a valid config variable.'.format(config)}
     self.assertEqual(ret, vsphere._set_syslog_config_helper(HOST, USER, PASSWORD, config, 'bar'))
Beispiel #3
0
 def test_set_syslog_config_helper_bad_retcode(self):
     '''
     Tests function returns False when the esxcli function returns an unsuccessful retcode.
     '''
     config = 'default-rotate'
     self.assertEqual({config: {'success': False, 'message': ERROR}},
                      vsphere._set_syslog_config_helper(HOST, USER, PASSWORD, config, 'foo'))
Beispiel #4
0
 def test_set_syslog_config_helper_success(self):
     '''
     Tests successful function return.
     '''
     config = 'logdir'
     self.assertEqual({config: {'success': True}},
                      vsphere._set_syslog_config_helper(HOST, USER, PASSWORD, config, 'foo'))
Beispiel #5
0
 def test_set_syslog_config_helper_bad_retcode(self):
     '''
     Tests function returns False when the esxcli function returns an unsuccessful retcode.
     '''
     config = 'default-rotate'
     self.assertEqual({config: {'success': False, 'message': ERROR}},
                      vsphere._set_syslog_config_helper(HOST, USER, PASSWORD, config, 'foo'))
Beispiel #6
0
 def test_set_syslog_config_helper_no_valid_reset(self):
     '''
     Tests function returns False when an invalid syslog config is passed.
     '''
     config = 'foo'
     ret = {'success': False, 'message': '\'{0}\' is not a valid config variable.'.format(config)}
     self.assertEqual(ret, vsphere._set_syslog_config_helper(HOST, USER, PASSWORD, config, 'bar'))
Beispiel #7
0
 def test_set_syslog_config_helper_success(self):
     '''
     Tests successful function return.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 0})):
         config = 'logdir'
         self.assertEqual({config: {'success': True}},
                          vsphere._set_syslog_config_helper(HOST, USER, PASSWORD, config, 'foo'))
Beispiel #8
0
 def test_set_syslog_config_helper_bad_retcode(self):
     '''
     Tests function returns False when the esxcli function returns an unsuccessful retcode.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 1, 'stdout': ERROR})):
         config = 'default-rotate'
         self.assertEqual({config: {'success': False, 'message': ERROR}},
                          vsphere._set_syslog_config_helper(HOST, USER, PASSWORD, config, 'foo'))