コード例 #1
0
ファイル: test_vsphere.py プロジェクト: cldeluna/salt
 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'))
コード例 #2
0
ファイル: test_vsphere.py プロジェクト: cldeluna/salt
 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'))
コード例 #3
0
ファイル: test_vsphere.py プロジェクト: cldeluna/salt
 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'))
コード例 #4
0
ファイル: vsphere_test.py プロジェクト: HowardMei/saltstack
 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'))
コード例 #5
0
ファイル: vsphere_test.py プロジェクト: HowardMei/saltstack
 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'))
コード例 #6
0
ファイル: vsphere_test.py プロジェクト: HowardMei/saltstack
 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'))
コード例 #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'))
コード例 #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'))