Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

Source code for tool_shed.test.functional.test_0540_get_all_metadata_from_api

import logging

from ..base.twilltestcase import (
    common,
    ShedTwillTestCase,
)

log = logging.getLogger(__name__)

repositories = dict(
    column=dict(
        name="column_maker_0540",
        description="Description for column_maker_0540",
        long_description="Long description for column_maker_0540",
    ),
    convert=dict(
        name="convert_chars_0540",
        description="Description for convert_chars_0540",
        long_description="Long description for convert_chars_0540",
    ),
    bwa=dict(
        name="package_bwa_0_5_9_0540",
        description="Description for package_bwa_0_5_9_0540",
        long_description="Long description for package_bwa_0_5_9_0540",
    ),
)

category_name = "Test 0540"
category_description = "Verify API endpoint to retrieve all metadata"

"""
1. Create repository column_maker_0540 as user user1.

2. Create repository convert_chars_0540 with dependency on column_maker_0540.

3. Create repository package_bwa_0_5_9_0540.

4. Create dependency on package_bwa_0_5_9_0540 for convert_chars_0540.

5. Load /api/repositories/convert_chars_0540.id/metadata and verify contents.
"""


[docs]class TestGetAllMetadata(ShedTwillTestCase): """Verify that the code correctly handles the repository admin role."""
[docs] def test_0000_initiate_users(self): """Create necessary user accounts.""" self.login(email=common.test_user_1_email, username=common.test_user_1_name) self.login(email=common.admin_email, username=common.admin_username)
[docs] def test_0005_create_bwa_package_repository(self): """Create and populate package_bwa_0_5_9_0540.""" category = self.create_category(name=category_name, description=category_description) self.login(email=common.test_user_1_email, username=common.test_user_1_name) # Create a repository named package_bwa_0_5_9_0100 owned by user1. repository = self.get_or_create_repository( name=repositories["bwa"]["name"], description=repositories["bwa"]["description"], long_description=repositories["bwa"]["long_description"], owner=common.test_user_1_name, category=category, strings_displayed=[], ) assert repository is not None, f"Error creating repository {repositories['bwa']['name']}" self.upload_file( repository, filename="0540_files/package_bwa/tool_dependencies.xml", filepath=None, valid_tools_only=True, uncompress_file=False, remove_repo_files_not_in_tar=False, commit_message="Uploaded tool_dependencies.xml.", strings_displayed=["This repository currently contains a single file named <b>tool_dependencies.xml</b>"], strings_not_displayed=[], ) # Visit the manage repository page for package_bwa_0_5_9_0100. self.display_manage_repository_page( repository, strings_displayed=["Tool dependencies", "will not be", "to this repository"] )
[docs] def test_0010_create_convert_repository(self): """Create the convert_chars_0540 repository.""" category = self.create_category(name=category_name, description=category_description) repository = self.get_or_create_repository( name=repositories["convert"]["name"], description=repositories["convert"]["description"], long_description=repositories["convert"]["long_description"], owner=common.test_user_1_name, category=category, strings_displayed=[], ) assert repository is not None, f"Error creating repository {repositories['convert']['name']}" self.upload_file( repository, filename="0540_files/convert_chars/convert_chars.tar", filepath=None, valid_tools_only=True, uncompress_file=True, remove_repo_files_not_in_tar=False, commit_message="Uploaded column maker 1.0.", strings_displayed=[], strings_not_displayed=[], ) # Add a dependency on BWA. self.upload_file( repository, filename="0540_files/convert_chars/tool_dependencies.xml", filepath=None, valid_tools_only=True, uncompress_file=True, remove_repo_files_not_in_tar=False, commit_message="Uploaded column maker 1.0.", strings_displayed=[], strings_not_displayed=[], ) # Visit the manage repository page for convert_chars_0540. self.display_manage_repository_page(repository, strings_displayed=[repositories["bwa"]["name"]])
[docs] def test_0015_create_column_repository(self): """Create the column_maker_0540 repository.""" category = self.create_category(name=category_name, description=category_description) repository = self.get_or_create_repository( name=repositories["column"]["name"], description=repositories["column"]["description"], long_description=repositories["column"]["long_description"], owner=common.test_user_1_name, category=category, strings_displayed=[], ) assert repository is not None, f"Error creating repository {repositories['column']['name']}" self.upload_file( repository, filename="0540_files/column_maker/column_maker.tar", filepath=None, valid_tools_only=True, uncompress_file=True, remove_repo_files_not_in_tar=False, commit_message="Uploaded column maker 1.0.", strings_displayed=[], strings_not_displayed=[], )
[docs] def test_0020_create_repository_dependency(self): """Make column_maker depend on convert_chars.""" repository = self._get_repository_by_name_and_owner(repositories["column"]["name"], common.test_user_1_name) self.upload_file( repository, filename="0540_files/column_maker/repository_dependencies.xml", filepath=None, valid_tools_only=True, uncompress_file=True, remove_repo_files_not_in_tar=False, commit_message="Uploaded column maker 2.0.", strings_displayed=[], strings_not_displayed=[], )
[docs] def test_0025_verify_dependency_json(self): """ Load the API endpoint to retrieve all repository metadata and verify that all three repository names are displayed. """ repository = self._get_repository_by_name_and_owner(repositories["column"]["name"], common.test_user_1_name) strings_displayed = [ repositories["column"]["name"], repositories["convert"]["name"], repositories["bwa"]["name"], ] self.fetch_repository_metadata(repository, strings_displayed=strings_displayed, strings_not_displayed=None)