def test_save_to_yaml(): """Test :func:`planemo.training.utils.save_to_yaml`.""" metadata = load_yaml(metadata_fp) new_metadata_fp = "metadata.yaml" save_to_yaml(metadata, new_metadata_fp) assert os.path.exists(new_metadata_fp) os.remove(new_metadata_fp)
def test_tutorial_init_data_lib(): """Test :func:`planemo.training.tutorial.tutorial.init_data_lib`.""" tuto = Tutorial(training=training, topic=topic) tuto.init_data_lib() assert tuto.data_lib['destination']['type'] == 'library' assert tuto.data_lib['items'][0]['name'] == topic.title assert tuto.data_lib['items'][0]['items'][0]['name'] == tuto.title # from existing data library file os.makedirs(tuto.dir) tuto.data_lib = {} tuto.init_data_lib() assert tuto.data_lib['items'][0]['name'] == topic.title assert tuto.data_lib['items'][0]['items'][0]['name'] == tuto.title # other tutorial already there and add the new one tuto.data_lib['items'][0]['items'][0]['name'] = 'Different tutorial' save_to_yaml(tuto.data_lib, tuto.data_lib_fp) tuto.init_data_lib() assert tuto.data_lib['items'][0]['items'][0][ 'name'] == 'Different tutorial' assert tuto.data_lib['items'][0]['items'][1]['name'] == tuto.title shutil.rmtree("topics")
def test_tutorial_init_data_lib(): """Test :func:`planemo.training.tutorial.tutorial.init_data_lib`.""" tuto = Tutorial( training=training, topic=topic) tuto.init_data_lib() assert tuto.data_lib['destination']['type'] == 'library' assert tuto.data_lib['items'][0]['name'] == topic.title assert tuto.data_lib['items'][0]['items'][0]['name'] == tuto.title # from existing data library file os.makedirs(tuto.dir) tuto.data_lib = {} tuto.init_data_lib() assert tuto.data_lib['items'][0]['name'] == topic.title assert tuto.data_lib['items'][0]['items'][0]['name'] == tuto.title # other tutorial already there and add the new one tuto.data_lib['items'][0]['items'][0]['name'] = 'Different tutorial' save_to_yaml(tuto.data_lib, tuto.data_lib_fp) tuto.init_data_lib() assert tuto.data_lib['items'][0]['items'][0]['name'] == 'Different tutorial' assert tuto.data_lib['items'][0]['items'][1]['name'] == tuto.title shutil.rmtree("topics")