def test_quast_complete_run_through():
    app = app_helper.setup_app_state('quast', 'execute')
    image_helper.execute_image(app)
    file_helper.assert_is_file(
        fs.get_task_file_path(app, 'outputs/assembly_metrics/684281f282'))
    file_helper.assert_is_file(
        fs.get_task_file_path(app, 'outputs/container_log/86bbc499b0'))
def test_complete_run_through():
    app = app_helper.setup_app_state('sra', 'inputs')
    image_helper.execute_image(app)

    file_helper.assert_is_file(fs.get_task_file_path(app, 'outputs/contig_fasta/01eb7cec61'))
    file_helper.assert_is_file(fs.get_task_file_path(app, 'outputs/container_runtime_metrics/metrics.json.gz'))
    file_helper.assert_is_file(fs.get_task_file_path(app, 'outputs/container_log/1099992390'))
def test_gaet_complete_run_through():
    app = app_helper.setup_app_state('gaet', 'execute')
    image_helper.execute_image(app)
    file_helper.assert_is_file(
        fs.get_task_file_path(app, 'outputs/assembly_metrics/d70c163200'))
    file_helper.assert_is_file(
        fs.get_task_file_path(app, 'outputs/container_log/1661337965'))
def test_execution_with_empty_contig_file():
    app = app_helper.setup_app_state('quast', 'execute')
    input_contigs = fs.get_task_file_path(app,
                                          "inputs/contig_fasta/de3d9f6d31.fa")
    open(input_contigs, "w").truncate()

    image_helper.execute_image(app)
    file_helper.assert_is_empty_directory(
        fs.get_task_file_path(app, 'outputs/assembly_metrics/'))
    file_helper.assert_is_empty_directory(
        fs.get_task_file_path(app, 'outputs/container_log/'))
def test_failing_image_with_no_outputs():
    image = {
        "name": "bioboxes/crash-test-biobox",
        "sha256":
        "eaf1ab35314712db9d3fff0d265613629fe628ed9b058a9a4fe94424184f8c41",
        "task": "exit-1",
        "type": "short_read_assembler"
    }
    app = app_helper.setup_app_state('sra', 'inputs')
    app["task"]["image"] = image
    app_helper.rewrite_app_task(app)
    image_helper.execute_image(app)
    file_helper.assert_is_file(
        fs.get_task_file_path(
            app, 'outputs/container_runtime_metrics/metrics.json.gz'))