def test_create_lua_script(): class BlaPlugin(): name = 'bla' js_matchers = [{'check': 'bla', 'version': 'bla.version'}] plugins = PluginCollection() plugins.add(BlaPlugin()) script = create_lua_script(plugins) assert script js_data = json.dumps(BlaPlugin.js_matchers) assert js_data in script
def test_create_lua_script(): class BlaPlugin(Plugin): name = 'bla' matchers = [{'dom': ('bla', 'bla.version')}] plugins = PluginCollection() plugins.add(BlaPlugin()) script = create_lua_script(plugins) assert script assert '"name": "bla"' in script assert '"check_statement": "bla"' in script assert '"version_statement": "bla.version"' in script
def _create_detector(self, har, plugins): pc = PluginCollection() for p in plugins: pc.add(p) return Detector({"har": har, "softwares": []}, pc, self.URL)