def test_import_tree_into_subfolder(self): folder = self.api.create_folder("tree-root") tree_dir = get_datafile("tree") res = self.api.import_tree(tree_dir, parent_folder_id=folder["id"]) self.assertEqual("OK", res["status"]) ## f, 2sf, and 3files in each sf self.assertEqual(9, len(res["path2Id"].keys()))
def test_import_tree_summary_doc_only(self): tree_dir = get_datafile("tree") res = self.api.import_tree( tree_dir, doc_creation=DocumentCreationStrategy.SUMMARY_DOC) self.assertEqual("OK", res["status"]) ## original folder + summary doc self.assertEqual(2, len(res["path2Id"].keys()))
def test_import_tree_summary_doc_per_subfolder(self): tree_dir = get_datafile("tree") res = self.api.import_tree( tree_dir, doc_creation=DocumentCreationStrategy.DOC_PER_SUBFOLDER) self.assertEqual("OK", res["status"]) ## original folder + 2 sf + 2 summary docs self.assertEqual(5, len(res["path2Id"].keys()))
def test_upload_downloadfile(self): file = get_datafile("fish_method.doc") try: with open(file, "rb") as to_upload: rs_file = self.api.upload_file(to_upload) rs_get = self.api.download_file(rs_file["id"], "out.doc") finally: os.remove(os.path.join(os.getcwd(), "out.doc"))
def test_post_retrieve_sample_template_icon(self): t_json = (template_builder.TemplateBuilder("WithIcon", "ml").text("Notes").number( "pH", 7).build()) st = self.invapi.create_sample_template(t_json) icon_file = base.get_datafile("antibodySample150.png") with open(icon_file, "rb") as icon: updated_template = self.invapi.set_sample_template_icon( st["id"], icon) self.assertTrue(updated_template["iconId"] > 0) outfile = "downloaded.png" try: self.invapi.get_sample_template_icon(st["id"], updated_template["iconId"], outfile) self.assertEqual(1600, os.path.getsize(outfile)) finally: os.remove(os.path.join(os.getcwd(), outfile))
def test_import_tree_include_dot_files(self): tree_dir = get_datafile("tree") res = self.api.import_tree(tree_dir, ignore_hidden_folders=False) self.assertEqual("OK", res["status"]) ## f, 2sf, and 3files in each sf + hidden self.assertTrue(len(res["path2Id"].keys()) > 10)
def test_import_tree(self): tree_dir = get_datafile("tree") res = self.api.import_tree(tree_dir) self.assertEqual("OK", res["status"]) ## f, 2sf, and 3files in each sf self.assertEqual(9, len(res["path2Id"].keys()))
def setUp(self): ## a grid container with 7 rows and 3 columns, cotaining 10 subsamples. path = base_test.get_datafile("container_by_id.json") with open(path, "r") as container: container_json = json.load(container) self.container = GridContainer(container_json)