def test_git_clone(self): repo_to_path = os.path.join(os.getcwd(), 'test_clone') repo_url = 'https://github.com/wdx7266/ontology-tutorialtoken.git' Box.git_clone(repo_url, repo_to_path) try: shutil.rmtree(repo_to_path) except PermissionError: pass
def boxes_cmd(ctx): """ List all available punica box. """ box = Box(ctx.obj['PROJECT_DIR']) try: box.list_boxes() except (PunicaException, SDKException): webbrowser.open('https://punica.ont.io/boxes/')
def init_cmd(ctx): """ Initialize new and empty Ontology project. """ box = Box(ctx.obj['PROJECT_DIR']) try: box.init_box() except (PunicaException, SDKException) as e: echo_cli_exception(e)
def unbox_cmd(ctx, box_name): """ Download a Punica Box, a pre-built Punica project """ box = Box(ctx.obj['PROJECT_DIR']) try: box.unbox(box_name) except (PunicaException, SDKException) as e: echo_cli_exception(e)
def test_unbox(self): box_name = 'tutorialtoken' box_to_path = os.path.join(os.getcwd(), 'test_unbox') Box.unbox(box_name, box_to_path) shutil.rmtree(box_to_path) box_name = 'errorbox' box_to_path = os.path.join(os.getcwd(), 'test_unbox') Box.unbox(box_name, box_to_path) shutil.rmtree(box_to_path)
def test_init(self): init_to_path = os.path.join(os.getcwd(), 'init') Box.init_box(init_to_path) init_config = InitConfig(init_to_path) self.assertTrue(os.path.exists(init_config.src_path())) self.assertTrue(os.path.exists(init_config.test_path())) self.assertTrue(os.path.exists(init_config.wallet_path())) self.assertTrue(os.path.exists(init_config.contract_path())) self.assertTrue(os.path.exists(os.path.join(init_config.test_path(), init_config.test_template_name()))) shutil.rmtree(init_to_path)
def unbox_cmd(ctx, box_name): """ Download a Punica Box, a pre-built Ontology DApp project. """ project_dir = ctx.obj['PROJECT_DIR'] try: Box.unbox(box_name, project_dir) except (PunicaException, SDKException): print('An error occur...') print('Punica will exist...') exit(1)
def init_cmd(ctx): """ Initialize new and empty Ontology DApp project. """ project_dir = ctx.obj['PROJECT_DIR'] try: Box.init(project_dir) except (PunicaException, SDKException) as e: print('An error occur...') print(e) print('Punica will exist...') exit(1)
def boxes_cmd(ctx): """ List all available punica box. """ boxes = Box.list_boxes() print('Various punica boxes are waiting for your:') for box in boxes: print('\t', box)
def boxes_cmd(ctx): """ List all available punica box. """ try: boxes = Box.list_boxes() except (PunicaException, SDKException) as e: webbrowser.open('https://punica.ont.io/boxes/') return print('Various punica boxes are waiting for your:') for box in boxes: print('\t', box)
def test_generate_repo_url(self): target_repo_url = 'https://github.com/punica-box/tutorialtoken-box.git' box_name = 'tutorialtoken' repo_url = Box.generate_repo_url(box_name) self.assertEqual(target_repo_url, repo_url)
def test_init(self): init_to_path = os.path.join(os.getcwd(), 'init') Box.init(init_to_path)
def test_list_boxes(self): boxes = Box.list_boxes() self.assertIn('interplanetary-album-box', boxes)
def test_list_boxes(self): try: boxes = Box.list_boxes() self.assertIn('interplanetary-album-box', boxes) except PunicaException as e: self.assertIn('API rate limit exceeded', e.args[1])