def test_upload_multiplexed(self):
    collection = self.res.collection.create(name='Test upload multiplexed')
    samplesheet = self.get_samplesheet()
    with self.assertLogs() as logs:
        collection.upload_demulti(samplesheet, basedir='files')
    self.assertEqual(len(logs.output), 39)
    upload_errprefix = 'ERROR:resdk.data_upload.multiplexed:'
    upload_errs = ["Skipping upload of 'reads.fastq.gz': No barcodes file given.", "Skipping upload of 'reads_paired_abyss_1.fastq.gz': No barcodes file given.", "Skipping upload of '': No forward reads given.", "Skipping upload of 'dummy.qseq': Missing barcode.", "Skipping upload of 'pool24.read1.small.fastq.bz2': Invalid file extension(s). (Options: .qseq)", "Skipping upload of 'pool24c.read1.small.qseq.bz2': Invalid file extension(s). (Options: .qseq)", "Demultiplex process not yet complete for 'pool24.read1.small.qseq.bz2'."]
    for error in upload_errs:
        message = (upload_errprefix + error)
        self.assertIn(message, logs.output)
    upload_fail = ['single-reads', 'paired-reads', 'Sample 1', 'Sample 2', 'Sample 3', 'bad single path', 'bad paired path', ' ,', 'missing annotator', 'missing organism', 'missing source', 'missing molecule', 'missing seq_type', 'missing barcode', 'other barcode', '01_1-1_IP_plus2', '02_1-1_IP_minus2', 'duplicated sample', 'invalid qseq', 'invalid qseq2', 'bad extension']
    for invalid in upload_fail:
        self.assertIn(invalid, logs.output[35])
    for missing in upload_fail:
        self.assertIn(missing, logs.output[36])
    upload_success = ['01_1-1_IP_plus,', '02_1-1_IP_minus,']
    for uploaded in upload_success:
        self.assertNotIn(uploaded, logs.output[35])
    names = [data.name for data in collection.data]
    qseq = 'pool24.read1.small.qseq.bz2'
    self.assertIn(qseq, names)
    with self.assertLogs() as logs2:
        collection.upload_demulti(samplesheet, basedir='files')
    already_up = (upload_errprefix + "Skipping upload of 'pool24.read1.small.qseq.bz2': File already uploaded.")
    self.assertIn(already_up, logs2.output)
    names = [data.name for data in collection.data]
    names.remove(qseq)
    self.assertNotIn(qseq, names)
def test_upload_multiplexed(self):
    collection = self.res.collection.create(name='Test upload multiplexed')
    samplesheet = self.get_samplesheet()
    with self.assertLogs() as logs:
        collection.upload_demulti(samplesheet, basedir='files')
    self.assertEqual(len(logs.output), 39)
    upload_errprefix = 'ERROR:resdk.data_upload.multiplexed:'
    upload_errs = ["Skipping upload of 'reads.fastq.gz': No barcodes file given.", "Skipping upload of 'reads_paired_abyss_1.fastq.gz': No barcodes file given.", "Skipping upload of : No forward reads given.", "Skipping upload of 'dummy.qseq': Missing barcode.", "Skipping upload of 'pool24.read1.small.fastq.bz2': Invalid file extension(s). (Options: .qseq)", "Skipping upload of 'pool24c.read1.small.qseq.bz2': Invalid file extension(s). (Options: .qseq)", "Demultiplex process not yet complete for 'pool24.read1.small.qseq.bz2'."]
    for error in upload_errs:
        message = (upload_errprefix + error)
        self.assertIn(message, logs.output)
    upload_fail = ['single-reads', 'paired-reads', 'Sample 1', 'Sample 2', 'Sample 3', 'bad single path', 'bad paired path', ' ,', 'missing annotator', 'missing organism', 'missing source', 'missing molecule', 'missing seq_type', 'missing barcode', 'other barcode', '01_1-1_IP_plus2', '02_1-1_IP_minus2', 'duplicated sample', 'invalid qseq', 'invalid qseq2', 'bad extension']
    for invalid in upload_fail:
        self.assertIn(invalid, logs.output[35])
    for missing in upload_fail:
        self.assertIn(missing, logs.output[36])
    upload_success = ['01_1-1_IP_plus,', '02_1-1_IP_minus,']
    for uploaded in upload_success:
        self.assertNotIn(uploaded, logs.output[35])
    names = [data.name for data in collection.data]
    qseq = 'pool24.read1.small.qseq.bz2'
    self.assertIn(qseq, names)
    with self.assertLogs() as logs2:
        collection.upload_demulti(samplesheet, basedir='files')
    already_up = (upload_errprefix + "Skipping upload of 'pool24.read1.small.qseq.bz2': File already uploaded.")
    self.assertIn(already_up, logs2.output)
    names = [data.name for data in collection.data]
    names.remove(qseq)
    self.assertNotIn(qseq, names)