Пример #1
0
 def test_find_all(self):
     from certbot._internal.plugins.disco import PluginsRegistry
     with mock.patch("certbot._internal.plugins.disco.pkg_resources") as mock_pkg:
         mock_pkg.iter_entry_points.side_effect = [iter([EP_SA]),
                                                   iter([EP_WR])]
         plugins = PluginsRegistry.find_all()
     self.assertTrue(plugins["sa"].plugin_cls is standalone.Authenticator)
     self.assertTrue(plugins["sa"].entry_point is EP_SA)
     self.assertTrue(plugins["wr"].plugin_cls is webroot.Authenticator)
     self.assertTrue(plugins["wr"].entry_point is EP_WR)
Пример #2
0
 def test_find_all(self):
     from certbot._internal.plugins.disco import PluginsRegistry
     with mock.patch("certbot._internal.plugins.disco.pkg_resources") as mock_pkg:
         mock_pkg.iter_entry_points.side_effect = [
             iter([EP_SA]), iter([EP_WR, self.ep1])
         ]
         with mock.patch.object(pkg_resources.EntryPoint, 'load') as mock_load:
             mock_load.side_effect = [
                 standalone.Authenticator, webroot.Authenticator,
                 null.Installer, null.Installer]
             plugins = PluginsRegistry.find_all()
     self.assertIs(plugins["sa"].plugin_cls, standalone.Authenticator)
     self.assertIs(plugins["sa"].entry_point, EP_SA)
     self.assertIs(plugins["wr"].plugin_cls, webroot.Authenticator)
     self.assertIs(plugins["wr"].entry_point, EP_WR)
     self.assertIs(plugins["ep1"].plugin_cls, null.Installer)
     self.assertIs(plugins["ep1"].entry_point, self.ep1)
     self.assertIs(plugins["p1:ep1"].plugin_cls, null.Installer)
     self.assertIs(plugins["p1:ep1"].entry_point, self.ep1)