Exemplo n.º 1
0
    def test_get_plugin_error(self):
        """
        Test that we cannot activate a plugin which does not exist.
        """
        BaseDataConnector.load_plugins('datasources/connectors')

        with self.assertRaises(KeyError):
            BaseDataConnector.get_plugin('thisplugindoesnotexist')
Exemplo n.º 2
0
    def setUp(self):
        from decouple import config

        BaseDataConnector.load_plugins('datasources/connectors')
        self.plugin = BaseDataConnector.get_plugin('HyperCat')

        self.api_key = config('HYPERCAT_CISCO_API_KEY')
        self.auth = None
Exemplo n.º 3
0
    def test_get_plugin_hypercat(self):
        """
        Test that we have the HyperCat plugin and can activate it.
        """
        BaseDataConnector.load_plugins('datasources/connectors')
        plugin = BaseDataConnector.get_plugin('HyperCat')

        self.assertIsNotNone(plugin)
Exemplo n.º 4
0
    def test_get_plugin_simple(self):
        """
        Test that we have the plugin for trivial APIs and can activate it.
        """
        BaseDataConnector.load_plugins('datasources/connectors')
        plugin = BaseDataConnector.get_plugin('DataSetConnector')

        self.assertIsNotNone(plugin)
Exemplo n.º 5
0
    def data_connector_class(self) -> typing.Type[BaseDataConnector]:
        """
        Get the data connector class for this source.

        :return: Data connector class
        """
        BaseDataConnector.load_plugins('datasources/connectors')

        try:
            plugin = BaseDataConnector.get_plugin(self.plugin_name)

        except KeyError as exc:
            if not self.plugin_name:
                raise ValueError('Data source plugin is not set') from exc

            raise KeyError('Data source plugin not found') from exc

        return plugin
Exemplo n.º 6
0
 def setUp(self):
     BaseDataConnector.load_plugins('datasources/connectors')
     self.plugin = BaseDataConnector.get_plugin('DataSetConnector')