def test_unsupported_proxy_details(self): with patch('salt.modules.vsphere.get_proxy_type', MagicMock(return_value='unsupported')): with self.assertRaises(CommandExecutionError) as excinfo: ret = vsphere._get_proxy_connection_details() self.assertEqual('\'unsupported\' proxy is not supported', excinfo.exception.strerror)
def test_esxi_proxy_host_details(self): with patch('salt.modules.vsphere.get_proxy_type', MagicMock(return_value='esxi')): with patch.dict(vsphere.__salt__, {'esxi.get_details': MagicMock(return_value=self.esxi_host_details)}): ret = vsphere._get_proxy_connection_details() self.assertEqual(('fake_host', 'fake_username', 'fake_password', 'fake_protocol', 'fake_port', 'fake_mechanism', 'fake_principal', 'fake_domain'), ret)