How to use the bioblend._tests.GalaxyTestBase.GalaxyTestBase function in bioblend

To help you get started, we’ve selected a few bioblend examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github galaxyproject / bioblend / bioblend / _tests / TestGalaxyWorkflows.py View on Github external
import json
import os
import shutil
import tempfile
import time

from . import GalaxyTestBase, test_util


class TestGalaxyWorkflows(GalaxyTestBase.GalaxyTestBase):

    @test_util.skip_unless_tool("cat1")
    @test_util.skip_unless_tool("cat")
    def test_workflow_scheduling(self):
        path = test_util.get_abspath(os.path.join('data', 'test_workflow_pause.ga'))
        workflow = self.gi.workflows.import_workflow_from_local_path(path)
        workflow_id = workflow["id"]
        history_id = self.gi.histories.create_history(name="TestWorkflowState")["id"]
        dataset1_id = self._test_dataset(history_id)

        invocations = self.gi.workflows.get_invocations(workflow_id)
        self.assertEqual(len(invocations), 0)

        invocation = self.gi.workflows.invoke_workflow(
            workflow["id"],
            inputs={"0": {"src": "hda", "id": dataset1_id}},
github galaxyproject / bioblend / bioblend / _tests / TestGalaxyDatasets.py View on Github external
import shutil
import tempfile

from . import (
    GalaxyTestBase,
    test_util
)


class TestGalaxyDatasets(GalaxyTestBase.GalaxyTestBase):

    def setUp(self):
        super().setUp()
        self.history_id = self.gi.histories.create_history(name='TestShowDataset')['id']
        self.dataset_contents = "line 1\nline 2\rline 3\r\nline 4"
        self.dataset_id = self._test_dataset(self.history_id, contents=self.dataset_contents)

    def tearDown(self):
        self.gi.histories.delete_history(self.history_id, purge=True)

    @test_util.skip_unless_galaxy('release_19.05')
    def test_show_nonexistent_dataset(self):
        with self.assertRaises(Exception):
            self.gi.datasets.show_dataset('nonexistent_id')

    def test_show_dataset(self):
github galaxyproject / bioblend / bioblend / _tests / TestGalaxyDatasetCollections.py View on Github external
from bioblend.galaxy import dataset_collections as collections

from . import GalaxyTestBase, test_util


@test_util.skip_unless_galaxy()
class TestGalaxyDatasetCollections(GalaxyTestBase.GalaxyTestBase):

    def test_create_list_in_history(self):
        history_id = self.gi.histories.create_history(name="TestDSListCreate")["id"]
        dataset1_id = self._test_dataset(history_id)
        dataset2_id = self._test_dataset(history_id)
        dataset3_id = self._test_dataset(history_id)
        collection_response = self.gi.histories.create_dataset_collection(
            history_id=history_id,
            collection_description=collections.CollectionDescription(
                name="MyDatasetList",
                elements=[
                    collections.HistoryDatasetElement(name="sample1", id=dataset1_id),
                    collections.HistoryDatasetElement(name="sample2", id=dataset2_id),
                    collections.HistoryDatasetElement(name="sample3", id=dataset3_id),
                ]
            )
github galaxyproject / bioblend / bioblend / _tests / TestGalaxyHistories.py View on Github external
"""
"""
import os
import shutil
import tarfile
import tempfile

from . import GalaxyTestBase, test_util


class TestGalaxyHistories(GalaxyTestBase.GalaxyTestBase):

    def setUp(self):
        super().setUp()
        self.default_history_name = "buildbot - automated test"
        self.history = self.gi.histories.create_history(name=self.default_history_name)

    def test_create_history(self):
        history_name = "another buildbot - automated test"
        new_history = self.gi.histories.create_history(name=history_name)
        self.assertIsNotNone(new_history['id'])
        self.assertEqual(new_history['name'], history_name)
        self.assertIsNotNone(new_history['url'])

    def test_update_history(self):
        new_name = 'buildbot - automated test renamed'
        new_annotation = 'Annotation for %s' % new_name
github galaxyproject / bioblend / bioblend / _tests / TestGalaxyDatasets.py View on Github external
import shutil
import tempfile

import six

from . import (
    GalaxyTestBase,
    test_util
)


class TestGalaxyDatasets(GalaxyTestBase.GalaxyTestBase):

    def setUp(self):
        super(TestGalaxyDatasets, self).setUp()
        self.history_id = self.gi.histories.create_history(name='TestShowDataset')['id']
        self.dataset_contents = "line 1\nline 2\rline 3\r\nline 4"
        self.dataset_id = self._test_dataset(self.history_id, contents=self.dataset_contents)

    def tearDown(self):
        self.gi.histories.delete_history(self.history_id, purge=True)

    @test_util.skip_unless_galaxy('release_19.05')
    def test_show_nonexistent_dataset(self):
        with self.assertRaises(Exception):
            self.gi.datasets.show_dataset('nonexistent_id')

    def test_show_dataset(self):
github galaxyproject / bioblend / bioblend / _tests / TestGalaxyGroups.py View on Github external
"""
WARNING: only admins can operate on groups!
"""
import uuid

from . import GalaxyTestBase


class TestGalaxyGroups(GalaxyTestBase.GalaxyTestBase):

    def setUp(self):
        super().setUp()
        self.name = 'test_%s' % uuid.uuid4().hex
        self.group = self.gi.groups.create_group(self.name)[0]

    def tearDown(self):
        # As of 2015/04/13, deleting a group is not possible through the API
        pass

    def test_create_group(self):
        self.assertEqual(self.group['name'], self.name)
        self.assertIsNotNone(self.group['id'])

    def test_get_groups(self):
        groups = self.gi.groups.get_groups()
github galaxyproject / bioblend / bioblend / _tests / TestGalaxyUsers.py View on Github external
"""
Tests the functionality of the Blend CloudMan API. These tests require working
credentials to supported cloud infrastructure.
"""
from . import GalaxyTestBase


class TestGalaxyUsers(GalaxyTestBase.GalaxyTestBase):

    def test_get_users(self):
        users = self.gi.users.get_users()
        for user in users:
            self.assertIsNotNone(user['id'])
            self.assertIsNotNone(user['email'])

    def test_show_user(self):
        current_user = self.gi.users.get_current_user()
        user = self.gi.users.show_user(current_user['id'])
        self.assertEqual(user['id'], current_user['id'])
        self.assertEqual(user['username'], current_user['username'])
        self.assertEqual(user['email'], current_user['email'])
        # The 2 following tests randomly fail
#        self.assertEqual(user['nice_total_disk_usage'], current_user['nice_total_disk_usage'])
#        self.assertEqual(user['total_disk_usage'], current_user['total_disk_usage'])
github galaxyproject / bioblend / bioblend / _tests / TestGalaxyQuotas.py View on Github external
import uuid

from . import GalaxyTestBase


class TestGalaxyQuotas(GalaxyTestBase.GalaxyTestBase):

    def setUp(self):
        super().setUp()
        # Quota names must be unique, and they're impossible to delete
        # without accessing the database.
        self.quota_name = 'BioBlend-Test-Quota-%s' % uuid.uuid4().hex
        self.quota = self.gi.quotas.create_quota(
            self.quota_name, 'testing', '100 GB', '=',
            default='registered'
        )

    def tearDown(self):
        self.gi.quotas.update_quota(self.quota['id'], default='registered')
        self.gi.quotas.update_quota(self.quota['id'], default='no')
        self.gi.quotas.delete_quota(self.quota['id'])
github galaxyproject / bioblend / bioblend / _tests / TestGalaxyRoles.py View on Github external
"""
Tests the functionality of the Blend CloudMan API. These tests require working
credentials to supported cloud infrastructure.
"""
import uuid

from . import GalaxyTestBase


class TestGalaxyRoles(GalaxyTestBase.GalaxyTestBase):

    def setUp(self):
        super().setUp()
        self.name = 'test_%s' % uuid.uuid4().hex
        self.description = 'automated test role'
        self.role = self.gi.roles.create_role(self.name, self.description)[0]

    def tearDown(self):
        # As of 2017/07/26, deleting a role is not possible through the API
        pass

    def test_get_roles(self):
        roles = self.gi.roles.get_roles()
        for role in roles:
            self.assertIsNotNone(role['id'])
            self.assertIsNotNone(role['name'])
github galaxyproject / bioblend / bioblend / _tests / TestGalaxyFolders.py View on Github external
from . import GalaxyTestBase

FOO_DATA = 'foo\nbar\n'


class TestGalaxyFolders(GalaxyTestBase.GalaxyTestBase):

    def setUp(self):
        super().setUp()
        self.name = 'automated test folder'
        self.library = self.gi.libraries.create_library(self.name, description='automated test', synopsis='automated test synopsis')
        self.folder = self.gi.folders.create_folder(self.library['root_folder_id'], self.name,
                                                    description="automatically created folder")

    def tearDown(self):
        self.gi.libraries.delete_library(self.library['id'])

    def test_create_folder(self):
        self.assertEqual(self.folder['name'], self.name)
        self.assertEqual(self.folder['description'], 'automatically created folder')

    def test_show_folder(self):