@mock.patch('certbot._internal.eff.handle_subscription')
@mock.patch('certbot._internal.log.post_arg_parse_setup')
@mock.patch('certbot._internal.main._report_new_cert')
@mock.patch('certbot.util.exe_exists')
def test_configurator_selection(self, mock_exe_exists, _, __, ___):
    mock_exe_exists.return_value = True
    real_plugins = disco.PluginsRegistry.find_all()
    args = ['--apache', '--authenticator', 'standalone']
    args = ['install', '--nginx', '--cert-path', test_util.temp_join('blah'), '--key-path', test_util.temp_join('blah'), '--nginx-server-root', '/nonexistent/thing', '-d', 'example.com', '--debug']
    if ('nginx' in real_plugins):
        (ret, _, _, _) = self._call(args)
        self.assertTrue(('The nginx plugin is not working' in ret))
        self.assertTrue(('MisconfigurationError' in ret))
    self._cli_missing_flag(['--standalone'], 'With the standalone plugin, you probably')
    with mock.patch('certbot._internal.main._init_le_client') as mock_init:
        with mock.patch('certbot._internal.main._get_and_save_cert') as mock_gsc:
            mock_gsc.return_value = mock.MagicMock()
            self._call(['certonly', '--manual', '-d', 'foo.bar'])
            (unused_config, auth, unused_installer) = mock_init.call_args[0]
            self.assertTrue(isinstance(auth, manual.Authenticator))
    with mock.patch('certbot._internal.main.certonly') as mock_certonly:
        self._call(['auth', '--standalone'])
        self.assertEqual(1, mock_certonly.call_count)
@mock.patch('certbot._internal.eff.handle_subscription')
@mock.patch('certbot._internal.log.post_arg_parse_setup')
@mock.patch('certbot._internal.main._report_new_cert')
@mock.patch('certbot.util.exe_exists')
def test_configurator_selection(self, mock_exe_exists, _, __, ___):
    mock_exe_exists.return_value = True
    real_plugins = disco.PluginsRegistry.find_all()
    args = ['--apache', '--authenticator', 'standalone']
    args = ['install', '--nginx', '--cert-path', test_util.temp_join('blah'), '--key-path', test_util.temp_join('blah'), '--nginx-server-root', '/nonexistent/thing', '-d', 'example.com', '--debug']
    if ('nginx' in real_plugins):
        (ret, _, _, _) = self._call(args)
        self.assertTrue(('The nginx plugin is not working' in ret))
        self.assertTrue(('MisconfigurationError' in ret))
    self._cli_missing_flag(['--standalone'], 'With the standalone plugin, you probably')
    with mock.patch('certbot._internal.main._init_le_client') as mock_init:
        with mock.patch('certbot._internal.main._get_and_save_cert') as mock_gsc:
            mock_gsc.return_value = mock.MagicMock()
            self._call(['certonly', '--manual', '-d', 'foo.bar'])
            (unused_config, auth, unused_installer) = mock_init.call_args[0]
            self.assertTrue(isinstance(auth, manual.Authenticator))
    with mock.patch('certbot._internal.main.certonly') as mock_certonly:
        self._call(['auth', '--standalone'])
        self.assertEqual(1, mock_certonly.call_count)