def test_add_delete(self): '''Should be able to add and delete new plugins. ''' new = plugins.Plugin(name='new', description='new', version=0) self.senpy.add_plugin(new) assert new in self.senpy.plugins() self.senpy.delete_plugin(new) assert new not in self.senpy.plugins()
def test_plugins(self): self.assertRaises(Error, plugins.Plugin) p = plugins.Plugin({ "name": "dummy", "version": 0, "extra_params": { "none": { "options": [ "es", ], "required": False, "default": "0" } } }) c = p.jsonld() assert '@type' in c assert c['@type'] == 'plugin' assert 'info' not in c assert 'repo' not in c assert 'extra_params' in c logging.debug('Framed:') logging.debug(c) p.validate() assert 'es' in c['extra_params']['none']['options'] assert isinstance(c['extra_params']['none']['options'], list)
def test_str(self): """The string representation shouldn't include private variables""" r = Results() p = plugins.Plugin({"name": "STR test", "version": 0}) p._testing = 0 s = str(p) assert "_testing" not in s r.analysis.append(p) s = str(r) assert "_testing" not in s