def restart(self, iss, tag, ev): """ Restart a test instance :param iss: :param tag: :param ev: :return: """ logger.info('restart test tool: {} {}'.format(iss, tag)) uqp, qp = unquote_quote(iss, tag) url = self.app.run_test_instance(*qp) if isinstance(url, Response): return conv_response(None, url) if url: # redirect back to entity page loc = '{}entity/{}'.format(self.rest.base_url, qp[0]) raise cherrypy.HTTPRedirect(loc) else: args = { 'title': "Action Failed", 'base': self.baseurl, 'note': 'Could not restart your test instance'} _msg = self.html['message.html'].format(**args) return as_bytes(_msg)
def restart(self, iss, tag, ev): """ Restart a test instance :param iss: :param tag: :param ev: :return: """ logger.info('restart test tool: {} {}'.format(iss, tag)) uqp, qp = unquote_quote(iss, tag) url = self.app.run_test_instance(*qp) if isinstance(url, Response): return conv_response(None, url) if url: # redirect back to entity page loc = '{}entity/{}'.format(self.rest.base_url, qp[0]) raise cherrypy.HTTPRedirect(loc) else: args = { 'title': "Action Failed", 'base': self.baseurl, 'note': 'Could not restart your test instance' } _msg = self.html['message.html'].format(**args) return as_bytes(_msg)
def restart_instance(self, iss, tag, action='restart'): uqp, qp = unquote_quote(iss, tag) logger.info('{} iss="{}", tag="{}"'.format(action, uqp[0], uqp[1])) url = self.app.run_test_instance(qp[0], qp[1]) if isinstance(url, Response): return conv_response(None, url) if url: args = { 'title': "Action performed", 'base': self.baseurl, 'note': 'Your test instance "{iss}:{tag}" has been ' '{act} as <a href="{url}">{url}</a>'.format(iss=uqp[0], tag=uqp[1], url=url, act=action) } else: args = { 'title': "Action Failed", 'base': self.baseurl, 'note': 'Could not {} your test instance'.format(action) } _msg = self.html['message.html'].format(**args) return as_bytes(_msg)
def run(self, test): resp = self.tester.run(test, **self.webenv) self.sh['session_info'] = self.info.session if resp is False or resp is True: pass elif isinstance(resp, list): return conv_response(self.sh.events, resp) elif isinstance(resp, bytes): return resp self.opresult()
def next(self, **kwargs): resp = self.tester.cont(**kwargs) self.sh['session_info'] = self.info.session if resp: if isinstance(resp, int): if resp == CRITICAL: exp = self.tester.conv.events.get_data(EV_EXCEPTION) if exp: raise cherrypy.HTTPError(message=exp[0]) else: self.opresult() else: return conv_response(self.sh['conv'].events, resp) else: self.opresult()
def next(self, **kwargs): resp = self.tester.cont(**kwargs) self.sh['session_info'] = self.info.session if resp: if isinstance(resp, int): if resp == CRITICAL: exp = self.tester.conv.events.get_data(EV_EXCEPTION) if exp: raise cherrypy.HTTPError(message=exp[0]) else: self.opresult() else: return conv_response(self.sh['conv'].events, resp) else: self.opresult()
def restart_instance(self, iss, tag, action='restart'): uqp, qp = unquote_quote(iss, tag) logger.info('{} iss="{}", tag="{}"'.format(action, uqp[0], uqp[1])) url = self.app.run_test_instance(qp[0], qp[1]) if isinstance(url, Response): return conv_response(None, url) if url: args = { 'title': "Action performed", 'base': self.baseurl, 'note': 'Your test instance "{iss}:{tag}" has been ' '{act} as <a href="{url}">{url}</a>'.format( iss=uqp[0], tag=uqp[1], url=url, act=action)} else: args = { 'title': "Action Failed", 'base': self.baseurl, 'note': 'Could not {} your test instance'.format(action)} _msg = self.html['message.html'].format(**args) return as_bytes(_msg)
def run(self, test): try: resp = self.tester.run(test, **self.webenv) except HTTPRedirect: raise except Exception as err: #test_id = list(self.flows.complete.keys())[0] _trace = exception_trace('run', err, logger) self.tester.conv.events.store(EV_FAULT, _trace) return self.display_exception(exception_trace=_trace) self.sh['session_info'] = self.info.session if isinstance(resp, dict): return self.display_exception(**resp) elif resp is False or resp is True: pass elif isinstance(resp, list): return conv_response(self.sh.events, resp) elif isinstance(resp, bytes): return resp self.opresult()
def run(self, test): try: resp = self.tester.run(test, **self.webenv) except HTTPRedirect: raise except Exception as err: #test_id = list(self.flows.complete.keys())[0] _trace = exception_trace('run', err, logger) self.tester.conv.events.store(EV_FAULT, _trace) return self.display_exception(exception_trace=_trace) self.sh['session_info'] = self.info.session if isinstance(resp, dict): return self.display_exception(**resp) elif resp is False or resp is True: pass elif isinstance(resp, list): return conv_response(self.sh.events, resp) elif isinstance(resp, bytes): return resp self.opresult()
def reset(self): self.sh.reset_session() return conv_response(self.sh.events, self.info.flow_list())
def handle_response(self, resp, index, oper=None): if resp: self.sh["index"] = index return conv_response(self.conv.events, resp) else: return None
def reset(self): self.sh.reset_session() return conv_response(self.sh.events, self.info.flow_list())
def handle_response(self, resp, index, oper=None): if resp: self.sh["index"] = index return conv_response(self.conv.events, resp) else: return None