def main(): cmd = Command() # tbears starting point result = cmd.run(sys.argv[1:]) if isinstance(result, int) is False: sys.exit(TBearsExceptionCode.OK.value) sys.exit(result)
def setUp(self): self.cmd = Command() self.project_name = 'a_test' self.project_class = 'ATest' self.start_conf = None try: self.cmd.cmdServer.stop(None) self.cmd.cmdScore.clear(None) except: pass
def setUp(self): self.cmd = Command() self.project_name = 'sample_prj' self.project_class = 'SampleClass' self.start_conf = None tbears_config_path = os.path.join(TEST_UTIL_DIRECTORY, f'test_tbears_server_config.json') start_conf = IconConfig(tbears_config_path, tbears_server_config) start_conf.load() start_conf['config'] = tbears_config_path self.start_conf = start_conf
def setUp(self): self.cmd = Command() tbears_server_config_path = os.path.join( TEST_UTIL_DIRECTORY, 'test_tbears_server_config.json') self.conf = IconConfig(tbears_server_config_path, tbears_server_config) self.conf.load() self.conf['config'] = tbears_server_config_path self.cmd.cmdServer.start(self.conf) # Check server started (before test Icon client, sever has to be started) self.assertTrue(self.check_server())
def setUp(self): self.cmd = Command() # start tbears_config_path = os.path.join(TEST_UTIL_DIRECTORY, f'test_tbears_server_config.json') self.start_conf = IconConfig(tbears_config_path, tbears_server_config) self.start_conf.load() self.start_conf['config'] = tbears_config_path self.start_conf = self.start_conf self.cmd.cmdServer.start(self.start_conf) self.assertTrue(self.cmd.cmdServer.is_service_running())
def setUp(self): self.cmd = Command() self.project_name = 'a_test' self.project_class = 'ATest' self.start_conf = None
class TbearsCommands(Magics): command_ins = Command() score_info = [] deployed_id = itertools.count(start=1) def run_command(self, command): try: full_command_list = f'{command}'.split() if full_command_list[0] == 'console': return response = self.command_ins.run(full_command_list) except: return else: global _r _r = response if isinstance(response, int): return if full_command_list[0] == 'deploy' and not response.get( "error", None): args = self.command_ins.parser.parse_args(full_command_list) conf = self.command_ins.cmdScore.get_icon_conf('deploy', args=vars(args)) self.score_info.append( f"{next(self.deployed_id)}." f"path : {conf['project']}, txhash : {response['result']}," f" deployed in : {conf['uri']}") return @line_magic def tbears(self, line): return self.run_command(line) @line_magic def deployresults(self, line): return page.page("\n".join(self.score_info)) @line_magic def init(self, line): return self.run_command(f"init {line}") @line_magic def samples(self, line): return self.run_command(f"samples {line}") @line_magic def clear(self, line): return self.run_command(f"clear {line}") @line_magic def deploy(self, line): return self.run_command(f"deploy {line}") @line_magic def start(self, line): return self.run_command(f"start {line}") @line_magic def stop(self, line): return self.run_command(f"stop {line}") @line_magic def keystore(self, line): return self.run_command(f"keystore {line}") @line_magic def transfer(self, line): return self.run_command(f"transfer {line}") @line_magic def txresult(self, line): return self.run_command(f"txresult {line}") @line_magic def balance(self, line): return self.run_command(f"balance {line}") @line_magic def totalsupply(self, line): return self.run_command(f"totalsupply {line}") @line_magic def scoreapi(self, line): return self.run_command(f"scoreapi {line}") @line_magic def txbyhash(self, line): return self.run_command(f"txbyhash {line}") @line_magic def lastblock(self, line): return self.run_command(f"lastblock {line}") @line_magic def block(self, line): return self.run_command(f"block {line}") @line_magic def blockbyhash(self, line): return self.run_command(f"blockbyhash {line}") @line_magic def blockbyheight(self, line): return self.run_command(f"blockbyheight {line}") @line_magic def genconf(self, line): return self.run_command(f"genconf {line}") @line_magic def sendtx(self, line): return self.run_command(f"sendtx {line}") @line_magic def call(self, line): return self.run_command(f"call {line}") @line_magic def test(self, line): return self.run_command(f"test {line}")
def setUp(self): self.cmd = Command() self.parser = self.cmd.parser self.keystore_path = 'unit_test_keystore' self.keystore_password = '******'
def setUp(self): self.cmd = Command() self.parser = self.cmd.parser self.subparsers = self.cmd.subparsers
def setUp(self): self.cmd = Command() self.project_name = 'sample_prj' self.project_class = 'SampleClass' self.start_conf = None
def setUp(self): self.cmd = Command() self.parser = self.cmd.parser self.subparsers = self.cmd.subparsers self.tear_down_params = [] self.verificationErrors = []