def new_map(self, sid=''): if not sid: sid = rndstr(16) op = self.provider_cls(**self.as_args) op.baseurl = '{}{}'.format(self.base_url, sid) op.name = op.baseurl _conv = Conversation(None, op, None) _conv.events = self.as_args['event_db'] _conv.data = self.data sh = SessionHandler(flows=self.flows, order=self.order) sh.init_session(self.profile) self._db[sid] = { 'op': op, 'conv': _conv, 'ts': time.time(), 'selected': {}, 'session_handler': sh, 'headlines': self.headlines } return sid
def run_return_types(test_id, oper_id, kwargs, return_types, single=True): for rtyp in return_types: kwargs['profile'] = rtyp kwargs['opid'] = oper_id + '_' + rtyp kwargs['tool_conf']['tag'] = kwargs['opid'] sh = SessionHandler(**kwargs) sh.init_session(profile=rtyp) res = Result(sh, SimpleProfileHandler) io = ClIO(**kwargs) io.session = sh tester = ClTester(io, sh, **kwargs) if single: tester.run(test_id, **kwargs) res.store_test_info() res.write_info(test_id) return True else: if not tester.match_profile(test_id): continue elif tester.run(test_id, **kwargs): print('+ {}'.format(test_id)) return True else: res = Result(sh, SimpleProfileHandler) res.result() return False
def new_map(self, sid=''): if not sid: sid = rndstr(16) op = self.provider_cls(**self.as_args) op.baseurl = '{}{}'.format(self.base_url, sid) op.name = op.baseurl _conv = Conversation(None, op, None) _conv.events = self.as_args['event_db'] _conv.data = self.data sh = SessionHandler(flows=self.flows, order=self.order) sh.init_session(self.profile) self._db[sid] = { 'op': op, 'conv': _conv, 'ts': time.time(), 'selected': {}, 'session_handler': sh, 'headlines': self.headlines } return sid
def run_return_types(test_id, oper_id, kwargs, return_types): if len(return_types) == 1: single = True else: single = False for rtyp in return_types: # One return_type at the time kwargs['profile'] = rtyp kwargs['opid'] = oper_id + '_' + rtyp kwargs['tool_conf']['tag'] = kwargs['opid'] sh = SessionHandler(**kwargs) sh.init_session() # res = Result(sh, SimpleProfileHandler) io = ClIh(session=sh, **kwargs) io.session = sh tester = ClTester(io, sh, **kwargs) if single: _res = tester.run(test_id, **kwargs) if _res is None: return False try: print('{} [{}] {}'.format(SIGN[_res], rtyp, test_id)) except Exception as err: print('****' + test_id + '*****') raise # res.store_test_info() # res.write_info(test_id) # sh.test_flows.store_test_info(tester) return True else: if not tester.match_profile(test_id): continue elif tester.run(test_id, **kwargs): print('+ [{}] {}'.format(rtyp, test_id)) else: sh.test_flows.store_test_info(tester) return False
def run_return_types(test_id, oper_id, kwargs, return_types): if len(return_types) == 1: single = True else: single = False for rtyp in return_types: # One return_type at the time kwargs['profile'] = rtyp kwargs['opid'] = oper_id + '_' + rtyp kwargs['tool_conf']['tag'] = kwargs['opid'] sh = SessionHandler(**kwargs) sh.init_session() # res = Result(sh, SimpleProfileHandler) io = ClIh(session=sh, **kwargs) io.session = sh tester = ClTester(io, sh, **kwargs) if single: _res = tester.run(test_id, **kwargs) if _res is None: return False try: print('{} [{}] {}'.format(SIGN[_res], rtyp, test_id)) except Exception as err: print('****' + test_id + '*****') raise # res.store_test_info() # res.write_info(test_id) # sh.test_flows.store_test_info(tester) return True else: if not tester.match_profile(test_id): continue elif tester.run(test_id, **kwargs): print('+ [{}] {}'.format(rtyp, test_id)) else: sh.test_flows.store_test_info(tester) return False
else: rtypes = [cargs.profile] if len(rtypes) == 1: run_return_types(cargs.test_id, cargs.id, kwargs, return_types=rtypes) else: _res = run_return_types(cargs.test_id, cargs.id, kwargs, rtypes, False) if cargs.exit and _res is False: exit() else: if cargs.profile: rtypes = [cargs.profile] else: rtypes = ['C'] _sh = SessionHandler(**kwargs) _sh.init_session(profile=rtypes[0]) if cargs.group: test_ids = [t for t in _sh["flow_names"] if t.startswith(cargs.group)] else: test_ids = _sh["flow_names"] for tid in test_ids: _res = run_return_types(tid, cargs.id, kwargs, rtypes, False) if cargs.exit and _res is False: exit(-1)