示例#1
0
 def test_set_syslog_config_firewall_success(self):
     '''
     Tests successful function return for a single ESXi host with 'loghost' as syslog_config.
     '''
     self.assertEqual({HOST: {'enable_firewall': {'success': True}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True))
示例#2
0
 def test_set_syslog_config_firewall_success(self):
     '''
     Tests successful function return for a single ESXi host with 'loghost' as syslog_config.
     '''
     self.assertEqual({HOST: {'enable_firewall': {'success': True}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True))
示例#3
0
 def test_set_syslog_config_firewall_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host with 'loghost' as syslog_config.
     '''
     self.assertEqual({HOST: {'enable_firewall': {'message': ERROR, 'success': False}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True))
示例#4
0
 def test_set_syslog_config_firewall_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host with 'loghost' as syslog_config.
     '''
     self.assertEqual({HOST: {'enable_firewall': {'message': ERROR, 'success': False}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True))
示例#5
0
 def test_set_syslog_config_host_list_firewall_success(self):
     '''
     Tests successful function return with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'enable_firewall': {'success': True}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True,
                                                esxi_hosts=[host_1]))
示例#6
0
 def test_set_syslog_config_host_list_firewall_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'enable_firewall': {'message': ERROR, 'success': False}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True,
                                                esxi_hosts=[host_1]))
示例#7
0
 def test_set_syslog_config_host_list_firewall_success(self):
     '''
     Tests successful function return with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'enable_firewall': {'success': True}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True,
                                                esxi_hosts=[host_1]))
示例#8
0
 def test_set_syslog_config_host_list_firewall_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'enable_firewall': {'message': ERROR, 'success': False}}},
                      vsphere.set_syslog_config(HOST,
                                                USER,
                                                PASSWORD,
                                                'loghost',
                                                'foo',
                                                firewall=True,
                                                esxi_hosts=[host_1]))
示例#9
0
 def test_set_syslog_config_firewall_success(self):
     '''
     Tests successful function return for a single ESXi host with 'loghost' as syslog_config.
     '''
     with patch('salt.modules.vsphere.enable_firewall_ruleset',
                MagicMock(return_value={HOST: {'retcode': 0}})):
         with patch('salt.modules.vsphere._set_syslog_config_helper',
                    MagicMock(return_value={})):
             self.assertEqual({HOST: {'enable_firewall': {'success': True}}},
                              vsphere.set_syslog_config(HOST,
                                                        USER,
                                                        PASSWORD,
                                                        'loghost',
                                                        'foo',
                                                        firewall=True))
示例#10
0
 def test_set_syslog_config_firewall_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host with 'loghost' as syslog_config.
     '''
     with patch('salt.modules.vsphere.enable_firewall_ruleset',
                MagicMock(return_value={HOST: {'retcode': 1, 'stdout': ERROR}})):
         with patch('salt.modules.vsphere._set_syslog_config_helper',
                    MagicMock(return_value={})):
             self.assertEqual({HOST: {'enable_firewall': {'message': ERROR, 'success': False}}},
                              vsphere.set_syslog_config(HOST,
                                                        USER,
                                                        PASSWORD,
                                                        'loghost',
                                                        'foo',
                                                        firewall=True))
示例#11
0
 def test_set_syslog_config_host_list_firewall_success(self):
     '''
     Tests successful function return with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     with patch('salt.modules.vsphere.enable_firewall_ruleset',
                MagicMock(return_value={'host_1.foo.com': {'retcode': 0}})):
         with patch('salt.modules.vsphere._set_syslog_config_helper',
                    MagicMock(return_value={})):
             host_1 = 'host_1.foo.com'
             self.assertEqual({host_1: {'enable_firewall': {'success': True}}},
                              vsphere.set_syslog_config(HOST,
                                                        USER,
                                                        PASSWORD,
                                                        'loghost',
                                                        'foo',
                                                        firewall=True,
                                                        esxi_hosts=[host_1]))
示例#12
0
 def test_set_syslog_config_host_list_firewall_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts with 'loghost' as syslog_config.
     '''
     with patch('salt.modules.vsphere.enable_firewall_ruleset',
                MagicMock(return_value={'host_1.foo.com': {'retcode': 1, 'stdout': ERROR}})):
         with patch('salt.modules.vsphere._set_syslog_config_helper',
                    MagicMock(return_value={})):
             host_1 = 'host_1.foo.com'
             self.assertEqual({host_1: {'enable_firewall': {'message': ERROR, 'success': False}}},
                              vsphere.set_syslog_config(HOST,
                                                        USER,
                                                        PASSWORD,
                                                        'loghost',
                                                        'foo',
                                                        firewall=True,
                                                        esxi_hosts=[host_1]))