예제 #1
0
    def test_data_type_tuple(self, collection_mock, data_mock):
        collection_mock.configure_mock(data=[1, 2], resolwe=MagicMock())
        data_mock.side_effect = [DATA1, DATA2]

        BaseCollection.download(collection_mock, data_type=('data:expression:', 'output.exp'))
        flist = [u'2/output.exp']
        collection_mock.resolwe.download_files.assert_called_once_with(flist, None)
예제 #2
0
    def test_data_type_short(self, collection_mock, data_mock):
        collection_mock.configure_mock(data=[1, 2], resolwe=MagicMock())
        data_mock.side_effect = [DATA1, DATA2]

        BaseCollection.download(collection_mock, data_type='fastq')
        flist = [u'1/reads.fq', u'1/arch.gz']
        collection_mock.resolwe.download_files.assert_called_once_with(flist, None)
예제 #3
0
    def test_field_name(self, collection_mock):
        collection_mock.configure_mock(data=[DATA0, DATA2], resolwe=MagicMock())
        BaseCollection.download(collection_mock, field_name='output.exp')
        flist = ['2/outfile.exp']
        collection_mock.resolwe._download_files.assert_called_once_with(flist, None)

        # Check if ok to also provide ``output_field`` that does not start with 'output'
        collection_mock.reset_mock()
        collection_mock.configure_mock(data=[DATA1, DATA0], resolwe=MagicMock())
        BaseCollection.download(collection_mock, field_name='fastq')
        flist = ['1/reads.fq', '1/arch.gz']
        collection_mock.resolwe._download_files.assert_called_once_with(flist, None)
예제 #4
0
    def test_field_name(self, collection_mock):
        collection_mock.configure_mock(data=[DATA0, DATA2],
                                       resolwe=MagicMock())
        BaseCollection.download(collection_mock, field_name="output.exp")
        flist = ["2/outfile.exp"]
        collection_mock.resolwe._download_files.assert_called_once_with(
            flist, None)

        # Check if ``output_field`` does not start with 'output'
        collection_mock.reset_mock()
        collection_mock.configure_mock(data=[DATA1, DATA0],
                                       resolwe=MagicMock())
        BaseCollection.download(collection_mock, field_name="fastq")
        flist = ["1/reads.fq", "1/arch.gz"]
        collection_mock.resolwe._download_files.assert_called_once_with(
            flist, None)
예제 #5
0
 def test_bad_field_name(self, collection_mock):
     message = "Invalid argument value `field_name`."
     with self.assertRaisesRegex(ValueError, message):
         BaseCollection.download(collection_mock, field_name=123)
예제 #6
0
 def test_bad_file_type(self, collection_mock):
     message = "Invalid argument value `file_type`."
     with six.assertRaisesRegex(self, ValueError, message):
         BaseCollection.download(collection_mock, file_type=123)
예제 #7
0
 def test_bad_data_type(self, collection_mock, data_mock):
     message = "Invalid argument value data_type."
     with six.assertRaisesRegex(self, ValueError, message):
         BaseCollection.download(collection_mock, data_type=123)