Exemplo n.º 1
0
def test_select_command(
    cli_runner: CliRunner,
    populated_stats_api: StatsAPI,
    demux_results_finished_dir: Path,
    flowcell_object: Flowcell,
    demultiplex_context: CGConfig,
):
    demultiplex_context.cg_stats_api_ = populated_stats_api
    # GIVEN a stats api with some information about a flowcell
    flowcell_id: str = flowcell_object.flowcell_id
    full_flowcell_name: str = flowcell_object.flowcell_full_name
    assert find.get_flowcell_id(flowcell_id)
    demux_results = DemuxResults(
        demux_dir=demux_results_finished_dir / full_flowcell_name,
        flowcell=flowcell_object,
        bcl_converter="bcl2fastq",
    )

    # GIVEN a project id
    project_id: str = ""
    for project in demux_results.projects:
        project_id = project.split("_")[-1]
    assert project_id

    # WHEN exporting the sample information
    result = cli_runner.invoke(select_project_cmd,
                               [flowcell_id, "--project", project_id],
                               obj=demultiplex_context)

    # THEN assert that the command exits with success
    assert result.exit_code == 0
    # THEN assert that the flowcell id if in the printing
    assert flowcell_id in result.output
Exemplo n.º 2
0
def fixture_nipt_upload_api_context(
        cg_context: CGConfig, nipt_stats_api: StatsAPI,
        re_sequenced_sample_store: Store) -> CGConfig:

    cg_context.status_db_ = re_sequenced_sample_store
    cg_context.cg_stats_api_ = nipt_stats_api

    return cg_context
Exemplo n.º 3
0
def fixture_demultiplex_context(
    demultiplexing_api: DemultiplexingAPI,
    stats_api: StatsAPI,
    real_housekeeper_api: HousekeeperAPI,
    cg_context: CGConfig,
) -> CGConfig:
    cg_context.demultiplex_api_ = demultiplexing_api
    cg_context.cg_stats_api_ = stats_api
    cg_context.housekeeper_api_ = real_housekeeper_api
    return cg_context
Exemplo n.º 4
0
def fixture_wipe_demultiplex_api(
    cg_context: CGConfig,
    demultiplexed_flowcells_working_directory: Path,
    flowcell_full_name: str,
    stats_api: StatsAPI,
) -> DeleteDemuxAPI:
    """Yield an initialized DeleteDemuxAPI"""
    cg_context.cg_stats_api_ = stats_api
    return DeleteDemuxAPI(
        config=cg_context,
        demultiplex_base=demultiplexed_flowcells_working_directory,
        dry_run=False,
        run_path=Path(flowcell_full_name),
    )
def test_set_dry_run_delete_demux_api(
    caplog,
    cg_context: CGConfig,
    demultiplexed_flowcells_working_directory: Path,
    flowcell_full_name: str,
    stats_api: StatsAPI,
):
    """Test to test function to set the API to run in dry run mode"""

    caplog.set_level(logging.DEBUG)
    cg_context.cg_stats_api_ = stats_api
    # WHEN setting the dry_run mode on a DeleteDemuxAPI
    wipe_demultiplex_api: DeleteDemuxAPI = DeleteDemuxAPI(
        config=cg_context,
        demultiplex_base=demultiplexed_flowcells_working_directory,
        dry_run=True,
        run_path=flowcell_full_name,
    )

    # THEN the dry run parameter should be set to True and it should be logged
    assert wipe_demultiplex_api.dry_run
    assert f"DeleteDemuxAPI: Setting dry run mode to True" in caplog.text