Пример #1
0
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
Пример #2
0
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
Пример #3
0
 def _create_detector(self, har, plugins):
     pc = PluginCollection()
     for p in plugins:
         pc.add(p)
     return Detector({"har": har, "softwares": []}, pc, self.URL)