@mock.patch('certbot._internal.main.plugins_disco')
@mock.patch('certbot._internal.main.cli.HelpfulArgumentParser.determine_help_topics')
def test_plugins_no_args_unprivileged(self, _det, mock_disco):
    ifaces: List[interfaces.IPlugin] = []
    plugins = mock_disco.PluginsRegistry.find_all()

    def throw_error(directory, mode, strict):
        'Raises error.Error.'
        (_, _, _) = (directory, mode, strict)
        raise errors.Error()
    stdout = io.StringIO()
    with mock.patch('certbot.util.set_up_core_dir') as mock_set_up_core_dir:
        with test_util.patch_get_utility_with_stdout(stdout=stdout):
            mock_set_up_core_dir.side_effect = throw_error
            (_, stdout, _, _) = self._call(['plugins'], stdout)
    plugins.visible.assert_called_once_with()
    plugins.visible().ifaces.assert_called_once_with(ifaces)
    filtered = plugins.visible().ifaces()
    self.assertEqual(stdout.getvalue().strip(), str(filtered))
@mock.patch('certbot._internal.main.plugins_disco')
@mock.patch('certbot._internal.main.cli.HelpfulArgumentParser.determine_help_topics')
def test_plugins_no_args_unprivileged(self, _det, mock_disco):
    ifaces: List[interfaces.IPlugin] = []
    plugins = mock_disco.PluginsRegistry.find_all()

    def throw_error(directory, mode, strict):
        'Raises error.Error.'
        (_, _, _) = (directory, mode, strict)
        raise errors.Error()
    stdout = io.StringIO()
    with mock.patch('certbot.util.set_up_core_dir') as mock_set_up_core_dir:
        with test_util.patch_get_utility_with_stdout(stdout=stdout):
            mock_set_up_core_dir.side_effect = throw_error
            (_, stdout, _, _) = self._call(['plugins'], stdout)
    plugins.visible.assert_called_once_with()
    plugins.visible().ifaces.assert_called_once_with(ifaces)
    filtered = plugins.visible().ifaces()
    self.assertEqual(stdout.getvalue().strip(), str(filtered))