예제 #1
0
def test_load_yaml():
    """Test :func:`planemo.training.utils.load_yaml`."""
    metadata = load_yaml(metadata_fp)
    # test if name there
    assert metadata["name"] == "test"
    # test if order of material is conserved
    assert metadata['maintainers'][0] == 'maintainer1'
예제 #2
0
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)
예제 #3
0
def test_topic_create_topic_structure():
    """Test :func:`planemo.training.topic.Topic.create_topic_structure`."""
    topic = Topic()
    topic.create_topic_structure()
    topic_name = "new_topic"
    topic_title = "The new topic"
    # check the folder and its structure
    assert topic.exists()
    assert os.path.exists(topic.img_folder)
    assert os.path.exists(topic.tuto_folder)
    # create the index.md and the topic name
    assert os.path.exists(topic.index_fp)
    assert topic_name in open(topic.index_fp, 'r').read()
    # create the README.md and the topic name
    assert os.path.exists(topic.readme_fp)
    assert topic_title in open(topic.readme_fp, 'r').read()
    # check metadata content
    assert os.path.exists(topic.metadata_fp)
    metadata = load_yaml(topic.metadata_fp)
    assert metadata['name'] == topic_name
    # check dockerfile
    assert os.path.exists(topic.dockerfile_fp)
    assert topic_name in open(topic.dockerfile_fp, 'r').read()
    assert topic_title in open(topic.dockerfile_fp, 'r').read()
    # check introduction slide
    assert os.path.exists(topic.intro_slide_fp)
    assert topic_title in open(topic.intro_slide_fp, 'r').read()
    # check in metadata directory
    assert os.path.exists(os.path.join("metadata", "%s.yaml" % topic_name))
    # clean
    shutil.rmtree(topic.parent_dir)
    shutil.rmtree("metadata")
예제 #4
0
def test_topic_create_topic_structure():
    """Test :func:`planemo.training.topic.Topic.create_topic_structure`."""
    topic = Topic()
    topic.create_topic_structure()
    topic_name = "new_topic"
    topic_title = "The new topic"
    # check the folder and its structure
    assert topic.exists()
    assert os.path.exists(topic.img_folder)
    assert os.path.exists(topic.tuto_folder)
    # create the index.md and the topic name
    assert os.path.exists(topic.index_fp)
    assert topic_name in open(topic.index_fp, 'r').read()
    # create the README.md and the topic name
    assert os.path.exists(topic.readme_fp)
    assert topic_title in open(topic.readme_fp, 'r').read()
    # check metadata content
    assert os.path.exists(topic.metadata_fp)
    metadata = load_yaml(topic.metadata_fp)
    assert metadata['name'] == topic_name
    # check dockerfile
    assert os.path.exists(topic.dockerfile_fp)
    assert topic_name in open(topic.dockerfile_fp, 'r').read()
    assert topic_title in open(topic.dockerfile_fp, 'r').read()
    # check introduction slide
    assert os.path.exists(topic.intro_slide_fp)
    assert topic_title in open(topic.intro_slide_fp, 'r').read()
    # check in metadata directory
    assert os.path.exists(os.path.join("metadata", "%s.yaml" % topic_name))
    # clean
    shutil.rmtree(topic.parent_dir)
    shutil.rmtree("metadata")
예제 #5
0
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)
예제 #6
0
def test_load_yaml():
    """Test :func:`planemo.training.utils.load_yaml`."""
    metadata = load_yaml(metadata_fp)
    # test if name there
    assert metadata["name"] == "test"
    # test if order of material is conserved
    assert metadata['maintainers'][0] == 'maintainer1'