def test_check_init_should_raise_unexpected_library_strategy_exception(
         self, mock_dir, accession, experiment_type, version,
         result_folder):
     mock_dir.return_value = "test"
     with pytest.raises(UnexpectedLibraryStrategyException):
         sanity_check.SanityCheck(accession, result_folder, experiment_type,
                                  version)
 def test_check_qc_not_passed_do_not_raise_exception(
         self, accession, experiment_type, version, result_folder):
     root_dir = os.path.join(os.path.dirname(__file__), "test_data")
     result_dir = os.path.join(root_dir, result_folder)
     test_instance = sanity_check.SanityCheck(accession, result_dir,
                                              experiment_type, version)
     test_instance.run_quality_control_check()
     assert True
 def test_coverage_check_succeeds(self, accession, experiment_type, version,
                                  result_folder, result_status):
     root_dir = os.path.join(os.path.dirname(__file__), "test_data")
     result_dir = os.path.join(root_dir, result_folder)
     test_instance = sanity_check.SanityCheck(accession, result_dir,
                                              experiment_type, version,
                                              result_status)
     test_instance.run_coverage_check()
     assert True
 def test_check_file_existence_wgs_v4_v5_results_succeeds(
         self, accession, experiment_type, version, result_folder,
         result_status):
     root_dir = os.path.join(os.path.dirname(__file__), "test_data")
     result_dir = os.path.join(root_dir, result_folder)
     test_instance = sanity_check.SanityCheck(accession, result_dir,
                                              experiment_type, version,
                                              result_status)
     test_instance.check_file_existence()
 def test_check_amplicon_v4_results_raise_exception(self, accession,
                                                    experiment_type,
                                                    version, result_folder):
     root_dir = os.path.join(os.path.dirname(__file__), "test_data")
     result_dir = os.path.join(root_dir, result_folder)
     test_instance = sanity_check.SanityCheck(accession, result_dir,
                                              experiment_type, version)
     with pytest.raises(FileNotFoundError):
         test_instance.check_file_existence()
 def test_coverage_check_should_raise_coverage_check_exception(
         self, accession, experiment_type, version, result_folder,
         result_status):
     root_dir = os.path.join(os.path.dirname(__file__), "test_data")
     result_dir = os.path.join(root_dir, result_folder)
     test_instance = sanity_check.SanityCheck(accession, result_dir,
                                              experiment_type, version,
                                              result_status)
     with pytest.raises(CoverageCheckException):
         test_instance.run_coverage_check()
 def test_check_file_existence_should_raise_file_not_found_error(
         self, accession, experiment_type, version, result_folder,
         result_status):
     root_dir = os.path.join(os.path.dirname(__file__), "test_data")
     result_dir = os.path.join(root_dir, result_folder)
     test_instance = sanity_check.SanityCheck(accession, result_dir,
                                              experiment_type, version,
                                              result_status)
     with pytest.raises(FileNotFoundError):
         test_instance.check_file_existence()
 def test_v5_check_qc_not_passed_select_no_qc_config(
         self, accession, experiment_type, version, result_folder, caplog):
     root_dir = os.path.join(os.path.dirname(__file__), "test_data")
     result_dir = os.path.join(root_dir, result_folder)
     test_instance = sanity_check.SanityCheck(accession,
                                              result_dir,
                                              experiment_type,
                                              version,
                                              result_status='no_qc')
     caplog.set_level(logging.INFO)
     assert 'no_qc' in caplog.text
 def test_check_amplicon_ssu_v5_results_succeeds(self):
     accession = "ERR2237853"
     experiment_type = "amplicon"
     version = "5.0"
     root_dir = os.path.join(os.path.dirname(__file__), "test_data")
     result_dir = os.path.join(
         root_dir,
         "results/2018/01/ERP106131/version_{}/ERR223/003/{}_MERGED_FASTQ".
         format(version, accession))
     test_instance = sanity_check.SanityCheck(accession,
                                              result_dir,
                                              experiment_type,
                                              version,
                                              result_status='full')
     test_instance.check_file_existence()