@mock.patch('certbot._internal.main.plugins_disco')
@mock.patch('certbot._internal.main.cli.HelpfulArgumentParser.determine_help_topics')
def test_plugins_prepare(self, _det, mock_disco):
    ifaces: List[interfaces.IPlugin] = []
    plugins = mock_disco.PluginsRegistry.find_all()
    stdout = io.StringIO()
    with test_util.patch_get_utility_with_stdout(stdout=stdout):
        (_, stdout, _, _) = self._call(['plugins', '--init', '--prepare'], stdout)
    plugins.visible.assert_called_once_with()
    plugins.visible().ifaces.assert_called_once_with(ifaces)
    filtered = plugins.visible().ifaces()
    self.assertEqual(filtered.init.call_count, 1)
    filtered.verify.assert_called_once_with(ifaces)
    verified = filtered.verify()
    verified.prepare.assert_called_once_with()
    verified.available.assert_called_once_with()
    available = verified.available()
    self.assertEqual(stdout.getvalue().strip(), str(available))
@mock.patch('certbot._internal.main.plugins_disco')
@mock.patch('certbot._internal.main.cli.HelpfulArgumentParser.determine_help_topics')
def test_plugins_prepare(self, _det, mock_disco):
    ifaces: List[interfaces.IPlugin] = []
    plugins = mock_disco.PluginsRegistry.find_all()
    stdout = io.StringIO()
    with test_util.patch_get_utility_with_stdout(stdout=stdout):
        (_, stdout, _, _) = self._call(['plugins', '--init', '--prepare'], stdout)
    plugins.visible.assert_called_once_with()
    plugins.visible().ifaces.assert_called_once_with(ifaces)
    filtered = plugins.visible().ifaces()
    self.assertEqual(filtered.init.call_count, 1)
    filtered.verify.assert_called_once_with(ifaces)
    verified = filtered.verify()
    verified.prepare.assert_called_once_with()
    verified.available.assert_called_once_with()
    available = verified.available()
    self.assertEqual(stdout.getvalue().strip(), str(available))