def __init__(self, options, with_termlog=True): super().__init__(options) self.view = view.View() self.view.sig_view_add.connect(self._sig_view_add) self.view.sig_view_remove.connect(self._sig_view_remove) self.view.sig_view_update.connect(self._sig_view_update) self.view.sig_view_refresh.connect(self._sig_view_refresh) self.events = eventstore.EventStore() self.events.sig_add.connect(self._sig_events_add) self.events.sig_refresh.connect(self._sig_events_refresh) self.options.changed.connect(self._sig_options_update) self.options.changed.connect(self._sig_settings_update) self.addons.add(*addons.default_addons()) self.addons.add( webaddons.WebAddon(), intercept.Intercept(), readfile.ReadFile(), static_viewer.StaticViewer(), self.view, self.events, ) if with_termlog: self.addons.add(termlog.TermLog(), termstatus.TermStatus()) self.app = app.Application( self, self.options.web_debug )
def test_static_viewer(tmpdir): s = static_viewer.StaticViewer() sa = save.Save() with taddons.context() as tctx: sa.save([tflow.tflow(resp=True)], str(tmpdir.join('foo'))) tctx.master.addons.add(s) tctx.configure(s, web_static_viewer=str(tmpdir), rfile=str(tmpdir.join('foo'))) assert tmpdir.join('index.html').check(file=1) assert tmpdir.join('static').check(dir=1) assert tmpdir.join('flows').check(dir=1)