Example #1
0
 def test_get_firewall_status_host_list_success(self):
     '''
     Tests successful function return when an esxi_host is provided.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'rulesets': {}, 'success': True}},
                      vsphere.get_firewall_status(HOST, USER, PASSWORD, esxi_hosts=[host_1]))
Example #2
0
 def test_get_firewall_status_success(self):
     '''
     Tests successful function return for a single ESXi host.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 0, 'stdout': ''})):
         self.assertEqual({HOST: {'rulesets': {}, 'success': True}},
                          vsphere.get_firewall_status(HOST, USER, PASSWORD))
Example #3
0
 def test_get_firewall_status_host_list_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'success': False, 'Error': ERROR, 'rulesets': None}},
                      vsphere.get_firewall_status(HOST, USER, PASSWORD, esxi_hosts=[host_1]))
Example #4
0
 def test_get_firewall_status_host_list_success(self):
     '''
     Tests successful function return when an esxi_host is provided.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'rulesets': {}, 'success': True}},
                      vsphere.get_firewall_status(HOST, USER, PASSWORD, esxi_hosts=[host_1]))
Example #5
0
 def test_get_firewall_status_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 1, 'stdout': ERROR})):
         self.assertEqual({HOST: {'success': False, 'Error': ERROR, 'rulesets': None}},
                          vsphere.get_firewall_status(HOST, USER, PASSWORD))
Example #6
0
 def test_get_firewall_status_host_list_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts.
     '''
     host_1 = 'host_1.foo.com'
     self.assertEqual({host_1: {'success': False, 'Error': ERROR, 'rulesets': None}},
                      vsphere.get_firewall_status(HOST, USER, PASSWORD, esxi_hosts=[host_1]))
Example #7
0
 def test_get_firewall_status_success(self):
     '''
     Tests successful function return for a single ESXi host.
     '''
     self.assertEqual({HOST: {
         'rulesets': {},
         'success': True
     }}, vsphere.get_firewall_status(HOST, USER, PASSWORD))
Example #8
0
 def test_get_firewall_status_host_list_success(self):
     '''
     Tests successful function return when an esxi_host is provided.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 0, 'stdout': ''})):
         host_1 = 'host_1.foo.com'
         self.assertEqual({host_1: {'rulesets': {}, 'success': True}},
                          vsphere.get_firewall_status(HOST, USER, PASSWORD, esxi_hosts=[host_1]))
Example #9
0
 def test_get_firewall_status_host_list_bad_retcode(self):
     '''
     Tests error message returned with list of esxi_hosts.
     '''
     with patch('salt.utils.vmware.esxcli', MagicMock(return_value={'retcode': 1, 'stdout': ERROR})):
         host_1 = 'host_1.foo.com'
         self.assertEqual({host_1: {'success': False, 'Error': ERROR, 'rulesets': None}},
                          vsphere.get_firewall_status(HOST, USER, PASSWORD, esxi_hosts=[host_1]))
Example #10
0
 def test_get_firewall_status_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host.
     '''
     self.assertEqual(
         {HOST: {
             'success': False,
             'Error': ERROR,
             'rulesets': None
         }}, vsphere.get_firewall_status(HOST, USER, PASSWORD))
Example #11
0
 def test_get_firewall_status_success(self):
     '''
     Tests successful function return for a single ESXi host.
     '''
     self.assertEqual({HOST: {'rulesets': {}, 'success': True}},
                      vsphere.get_firewall_status(HOST, USER, PASSWORD))
Example #12
0
 def test_get_firewall_status_bad_retcode(self):
     '''
     Tests error message given for a single ESXi host.
     '''
     self.assertEqual({HOST: {'success': False, 'Error': ERROR, 'rulesets': None}},
                      vsphere.get_firewall_status(HOST, USER, PASSWORD))