def test_create_sample_sheet_no_run_parameters( cli_runner: testing.CliRunner, flowcell_working_directory_no_run_parameters: Path, sample_sheet_context: CGConfig, caplog, mocker, ): # GIVEN a folder with a non existing sample sheet flowcell_object: Flowcell = Flowcell( flowcell_working_directory_no_run_parameters) assert flowcell_object.run_parameters_path.exists() is False mocker.patch("cg.cli.demultiplex.sample_sheet.flowcell_samples", return_value=[{ "sample": 1 }]) demux_api: DemultiplexingAPI = sample_sheet_context.demultiplex_api demux_api.run_dir = flowcell_working_directory_no_run_parameters.parent sample_sheet_context.demultiplex_api_ = demux_api # WHEN running the create sample sheet command result: testing.Result = cli_runner.invoke( create_sheet, [flowcell_object.flowcell_full_name], obj=sample_sheet_context) # THEN assert it exits with a non zero exit code assert result.exit_code != 0 # THEN assert the correct information is communicated assert "Could not find run parameters file" in caplog.text
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