コード例 #1
0
    def __init__(self, config=None, **kwargs):
        self.config = config or MockAppConfig(**kwargs)
        self.security = self.config.security
        self.name = kwargs.get('name', 'galaxy')
        self.object_store = objectstore.build_object_store_from_config(
            self.config)
        self.model = mapping.init("/tmp",
                                  self.config.database_connection,
                                  create_tables=True,
                                  object_store=self.object_store)
        self.security_agent = self.model.security_agent
        self.visualizations_registry = MockVisualizationsRegistry()
        self.tag_handler = tags.GalaxyTagHandler(self.model.context)
        self.quota_agent = quota.QuotaAgent(self.model)
        self.init_datatypes()
        self.job_config = Bunch(dynamic_params=None, destinations={})
        self.tool_data_tables = {}
        self.dataset_collections_service = None
        self.container_finder = NullContainerFinder()
        self._toolbox_lock = MockLock()
        self.tool_shed_registry = Bunch(tool_sheds={})
        self.genome_builds = GenomeBuilds(self)
        self.job_manager = NoopManager()
        self.application_stack = ApplicationStack()
        self.auth_manager = AuthManager(self)

        def url_for(*args, **kwds):
            return "/mock/url"

        self.url_for = url_for
コード例 #2
0
    def __init__(self, test_directory, mock_model=True):
        # The following line is needed in order to create
        # HistoryDatasetAssociations - ideally the model classes would be
        # usable without the ORM infrastructure in place.
        in_memomry_model = mapping.init("/tmp",
                                        "sqlite:///:memory:",
                                        create_tables=True)

        self.datatypes_registry = Bunch(
            integrated_datatypes_configs=
            '/galaxy/integrated_datatypes_configs.xml',
            get_datatype_by_extension=lambda ext: Bunch(),
        )

        self.config = Bunch(
            outputs_to_working_directory=False,
            commands_in_new_shell=True,
            new_file_path=os.path.join(test_directory, "new_files"),
            tool_data_path=os.path.join(test_directory, "tools"),
            root=os.path.join(test_directory, "galaxy"),
            admin_users="*****@*****.**",
            len_file_path=os.path.join('tool-data', 'shared', 'ucsc', 'chrom'),
            builds_file_path=os.path.join('tool-data', 'shared', 'ucsc',
                                          'builds.txt.sample'),
            migrated_tools_config=os.path.join(test_directory,
                                               "migrated_tools_conf.xml"),
        )

        # Setup some attributes for downstream extension by specific tests.
        self.job_config = Bunch(dynamic_params=None, )

        # Two ways to handle model layer, one is to stub out some objects that
        # have an interface similar to real model (mock_model) and can keep
        # track of 'persisted' objects in a map. The other is to use a real
        # sqlalchemy layer but target an in memory database. Depending on what
        # is being tested.
        if mock_model:
            # Create self.model to mimic app.model.
            self.model = Bunch(context=MockContext())
            for module_member_name in dir(galaxy.model):
                module_member = getattr(galaxy.model, module_member_name)
                if type(module_member) == type:
                    self.model[module_member_name] = module_member
        else:
            self.model = in_memomry_model
        self.genome_builds = GenomeBuilds(self)
        self.toolbox = None
        self.object_store = None
        self.security = SecurityHelper(id_secret="testing")
        from galaxy.security import GalaxyRBACAgent
        self.job_queue = NoopQueue()
        self.security_agent = GalaxyRBACAgent(self.model)
        self.tool_data_tables = {}
        self.dataset_collections_service = None
        self.container_finder = NullContainerFinder()
        self.name = "galaxy"
コード例 #3
0
 def __init__(self, config=None, **kwargs):
     self.config = config or MockAppConfig(**kwargs)
     self.security = self.config.security
     self.name = kwargs.get('name', 'galaxy')
     self.object_store = objectstore.build_object_store_from_config(self.config)
     self.model = mapping.init("/tmp", "sqlite:///:memory:", create_tables=True, object_store=self.object_store)
     self.security_agent = self.model.security_agent
     self.visualizations_registry = MockVisualizationsRegistry()
     self.tag_handler = tags.GalaxyTagManager(self.model.context)
     self.quota_agent = quota.QuotaAgent(self.model)
     self.init_datatypes()
     self.job_config = Bunch(
         dynamic_params=None,
     )
     self.tool_data_tables = {}
     self.dataset_collections_service = None
     self.container_finder = NullContainerFinder()
     self._toolbox_lock = MockLock()
     self.genome_builds = GenomeBuilds(self)
     self.job_manager = Bunch(job_queue=NoopQueue())
     self.application_stack = ApplicationStack()