def get_wrapper(self): """ Return a Lua wrapper for this object. """ # FIXME: cache file contents splash_lua_code = get_script_source("splash.lua") self.lua.execute(splash_lua_code) wrapper = self.lua.globals()["Splash"] return wrapper(self)
class EmulatedJsRedirectTest(Base.EmulationMixin, test_redirects.JsRedirectTest): script = get_script_source("render_html.lua") # Overridden to return 400. @unittest.skipIf(NON_EXISTING_RESOLVABLE, "non existing hosts are resolvable") def test_redirect_to_non_existing(self): r = self.request({ "url": self.mockurl("jsredirect-non-existing"), "wait": 0.2, }) self.assertStatusCode(r, 400)
class EmulatedRenderPngTest(Base.EmulationMixin, test_render.RenderPngTest): script = get_script_source("render_png.lua") # TODO: default width and height are not applied @pytest.mark.xfail def test_ok(self): super(EmulatedRenderPngTest, self).test_ok() @pytest.mark.xfail def test_ok_https(self): super(EmulatedRenderPngTest, self).test_ok_https() # TODO: fix validation @pytest.mark.xfail def test_viewport_out_of_bounds(self): super(EmulatedRenderPngTest, self).test_viewport_out_of_bounds() @pytest.mark.xfail def test_viewport_invalid(self): super(EmulatedRenderPngTest, self).test_viewport_invalid() @pytest.mark.xfail def test_range_checks(self): super(EmulatedRenderPngTest, self).test_range_checks()
def get_example_script(self): return get_script_source("example.lua")
class EmulatedRenderHarTest(Base.EmulationMixin, test_har.HarRenderTest): script = get_script_source("render_har.lua")
class EmulatedMetaRedirectTest(Base.EmulationMixin, test_redirects.MetaRedirectTest): script = get_script_source("render_html.lua")
class EmulatedRenderHtmlTest(Base.EmulationMixin, test_render.RenderHtmlTest): script = get_script_source("render_html.lua")
def get_example_script(self): return get_script_source("example.lua")