Esempio n. 1
0
 def test_zero_samples_igocomplete_false(self, mock_get_sample):
     mock_get_sample.return_value = MockResponse(
         json_data=self.data_0_fastq, status_code=200)
     with self.assertRaises(MissingDataException):
         fetch_sample_metadata('igoId_000', False, 'sampleName_000', {})
     count_files = FileRepository.all().count()
     self.assertEqual(count_files, 0)
Esempio n. 2
0
 def test_import_sample_two_fastq_files(self, mock_get_sample):
     mock_get_sample.return_value = MockResponse(
         json_data=self.data_2_fastq, status_code=200)
     fetch_sample_metadata('igoId_002', True, 'sampleName_002', {})
     count_files = FileRepository.filter(path_in=[
         "/path/to/sample/08/sampleName_002-d_IGO_igoId_002_S134_L008_R2_001.fastq.gz",
         "/path/to/sample/08/sampleName_002-d_IGO_igoId_002_S134_L008_R1_001.fastq.gz"
     ]).count()
     self.assertEqual(count_files, 2)
Esempio n. 3
0
 def test_import_sample_six_fastq_files(self, mock_get_sample):
     mock_get_sample.return_value = MockResponse(
         json_data=self.data_6_fastq, status_code=200)
     fetch_sample_metadata('igoId_006', True, 'sampleName_006', {})
     count_files = FileRepository.filter(path_in=[
         "/path/to/sample/01/sampleName_006_IGO_igoId_006_S64_L007_R2_001.fastq.gz",
         "/path/to/sample/01/sampleName_006_IGO_igoId_006_S64_L007_R1_001.fastq.gz",
         "/path/to/sample/01/sampleName_006_IGO_igoId_006_S64_L006_R1_001.fastq.gz",
         "/path/to/sample/01/sampleName_006_IGO_igoId_006_S64_L006_R2_001.fastq.gz",
         "/path/to/sample/02/sampleName_006_IGO_igoId_006_S54_L003_R1_001.fastq.gz",
         "/path/to/sample/02/sampleName_006_IGO_igoId_006_S54_L003_R2_001.fastq.gz"
     ]).count()
     self.assertEqual(count_files, 6)
Esempio n. 4
0
 def test_file_conflict(self, mock_get_sample):
     file_conflict = File.objects.create(
         path=
         "/path/to/sample/08/sampleName_002-d_IGO_igoId_002_S134_L008_R2_001.fastq.gz",
         file_type=self.fastq,
         file_group=self.file_group,
     )
     file_metadata = FileMetadata.objects.create(file=file_conflict,
                                                 version=1,
                                                 metadata={})
     mock_get_sample.return_value = MockResponse(
         json_data=self.data_2_fastq, status_code=200)
     with self.assertRaises(ErrorInconsistentDataException) as e:
         fetch_sample_metadata('igoId_002', True, 'sampleName_002', {})
         self.assertTrue('Conflict of fastq file(s)' in str(e))
     count_files = FileRepository.filter(path_in=[
         "/path/to/sample/08/sampleName_002-d_IGO_igoId_002_S134_L008_R2_001.fastq.gz",
     ]).count()
     self.assertEqual(count_files, 1)
Esempio n. 5
0
 def test_zero_fastq_files(self, mock_get_sample):
     mock_get_sample.return_value = MockResponse(
         json_data=self.data_0_fastq, status_code=200)
     with self.assertRaises(ErrorInconsistentDataException) as e:
         fetch_sample_metadata('igoId_000', True, 'sampleName_000', {})
         self.assertTrue("Missing fastq files for igcomplete: " in str(e))