Warning

This document is for an in-development version 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_0480_tool_dependency_xml_verification

import logging

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

log = logging.getLogger(__name__)

category_name = "Test 0480 Tool dependency definition validation"
category_description = "Test script 0480 for validating tool dependency definitions."
repository_name = "package_invalid_tool_dependency_xml_1_0_0"
repository_description = "Contains a tool dependency definition that should return an error."
repository_long_description = "This repository is in the test suite 0480"

"""

1. Create a repository package_invalid_tool_dependency_xml_1_0_0
2. Upload a tool_dependencies.xml file to the repository with no <actions> tags around the <action> tags.
3. Verify error message is displayed.

"""


[docs]class TestDependencyDefinitionValidation(ShedTwillTestCase): """Test the tool shed's tool dependency XML validation."""
[docs] def test_0000_initiate_users_and_category(self): """Create necessary user accounts and login as an admin user.""" self.login(email=common.admin_email, username=common.admin_username) admin_user = self.test_db_util.get_user(common.admin_email) assert admin_user is not None, f"Problem retrieving user with email {common.admin_email} from the database" self.test_db_util.get_private_role(admin_user) self.create_category(name=category_name, description=category_description) self.login(email=common.test_user_2_email, username=common.test_user_2_name) test_user_2 = self.test_db_util.get_user(common.test_user_2_email) assert ( test_user_2 is not None ), f"Problem retrieving user with email {common.test_user_2_email} from the database" self.test_db_util.get_private_role(test_user_2) self.login(email=common.test_user_1_email, username=common.test_user_1_name) test_user_1 = self.test_db_util.get_user(common.test_user_1_email) assert ( test_user_1 is not None ), f"Problem retrieving user with email {common.test_user_1_email} from the database" self.test_db_util.get_private_role(test_user_1)
[docs] def test_0005_create_tool_dependency_repository(self): """Create and populate package_invalid_tool_dependency_xml_1_0_0. This is step 1 - Create a repository package_invalid_tool_dependency_xml_1_0_0. Create a repository named package_invalid_tool_dependency_xml_1_0_0 that will contain only a single file named tool_dependencies.xml. """ category = self.test_db_util.get_category_by_name(category_name) repository = self.get_or_create_repository( name=repository_name, description=repository_description, long_description=repository_long_description, owner=common.test_user_1_name, category_id=self.security.encode_id(category.id), strings_displayed=[], ) self.upload_file( repository, filename="0480_files/tool_dependencies.xml", filepath=None, valid_tools_only=False, uncompress_file=False, remove_repo_files_not_in_tar=False, commit_message="Populate package_invalid_tool_dependency_xml_1_0_0 with an improperly defined tool dependency.", strings_displayed=["package cannot be installed because", "missing either an &lt;actions&gt; tag set"], strings_not_displayed=[], )
[docs] def test_0010_populate_tool_dependency_repository(self): """Verify package_invalid_tool_dependency_xml_1_0_0. This is step 3 - Verify repository. The uploaded tool dependency XML should not have resulted in a new changeset. """ repository = self.test_db_util.get_repository_by_name_and_owner(repository_name, common.test_user_1_name) assert self.repository_is_new( repository ), "Uploading an incorrectly defined tool_dependencies.xml resulted in a changeset being generated."