Commit c349ae6e authored by Cage, Gregory's avatar Cage, Gregory
Browse files

Add testing for remote file and force_upload

parent 78789cba
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
"""Tests for datasets."""

import pytest
from bioblend.galaxy import GalaxyInstance
from bioblend.galaxy.datasets import DatasetClient

from nova.galaxy.connection import Connection
from nova.galaxy.dataset import Dataset

REMOTE_FILE_PATH = ""


def test_dataset_upload(nova_instance: Connection) -> None:
    with nova_instance.connect() as connection:
@@ -24,6 +30,18 @@ def test_dataset_set_content_upload(nova_instance: Connection) -> None:
        assert input.get_content() is not None


@pytest.mark.skip
def test_remote_file_ingest(nova_instance: Connection, galaxy_instance: GalaxyInstance) -> None:
    with nova_instance.connect() as connection:
        store = connection.get_data_store(name="nova_galaxy_testing")
        store.mark_for_cleanup()
        data = Dataset(path=REMOTE_FILE_PATH, remote_file=True)
        data.upload(store=store)
        dataset_client = DatasetClient(galaxy_instance)
        dataset_upstream = dataset_client.show_dataset(dataset_id=data.id)
        assert dataset_upstream is not None


def test_dataset_collection_upload(nova_instance: Connection) -> None:
    # TODO: Dataset collection uploading needs to be implemented
    pass
+16 −0
Original line number Diff line number Diff line
@@ -173,3 +173,19 @@ def test_wait_for_results(nova_instance: Connection, galaxy_instance: GalaxyInst
    test_tool.wait_for_results()
    assert test_tool.get_results() is not None
    connection.close()


def test_existing_dataset_as_parameter(nova_instance: Connection, galaxy_instance: GalaxyInstance) -> None:
    with nova_instance.connect() as connection:
        store = connection.get_data_store(name="nova_galaxy_testing")
        store.mark_for_cleanup()
        test_tool = Tool(TEST_TOOL_ID)
        test_data = Dataset(path="tests/test_files/test_text_file.txt", force_upload=False)
        test_data.upload(store=store)
        params = Parameters()
        params.add_input("test", test_data)
        # doesn't matter here if tool fails
        test_tool.run(data_store=store, params=params)
        history_content = galaxy_instance.histories.show_history(history_id=store.history_id, contents=True)
        # should only be 2 elements here (tool and the dataset passed as param), since dataset was manually uploaded
        assert len(history_content) == 2