def test_download_file_genbank_mismatch(req, tmpdir): entry = {'ftp_path': 'ftp://fake/path'} fake_file = tmpdir.join('fake_genomic.gbff.gz') fake_file.write('foo') assert fake_file.check() checksums = [{'checksum': 'fake', 'file': fake_file.basename}] dl_dir = tmpdir.mkdir('download') req.get('https://fake/path/fake_genomic.gbff.gz', text=fake_file.read()) assert core.worker(core.download_file_job(entry, str(dl_dir), checksums)) is False
def test_download_file_genbank_mismatch(req, tmpdir): entry = {'ftp_path': 'ftp://fake/path'} fake_file = tmpdir.join('fake_genomic.gbff.gz') fake_file.write('foo') assert fake_file.check() checksums = [{'checksum': 'fake', 'file': fake_file.basename}] dl_dir = tmpdir.mkdir('download') req.get('https://fake/path/fake_genomic.gbff.gz', text=fake_file.read()) assert core.worker(core.download_file_job(entry, str(dl_dir), checksums)) is False
def test_download_file_rm_out(req, tmpdir): entry = {'ftp_path': 'ftp://fake/path'} fake_file = tmpdir.join('fake_rm.out.gz') fake_file.write('foo') assert fake_file.check() checksum = core.md5sum(str(fake_file)) checksums = [{'checksum': checksum, 'file': fake_file.basename}] dl_dir = tmpdir.mkdir('download') req.get('https://fake/path/fake_rm.out.gz', text=fake_file.read()) assert core.worker(core.download_file_job(entry, str(dl_dir), checksums, 'rm'))
def test_download_file_rm_out(req, tmpdir): entry = {'ftp_path': 'ftp://fake/path'} fake_file = tmpdir.join('fake_rm.out.gz') fake_file.write('foo') assert fake_file.check() checksum = core.md5sum(str(fake_file)) checksums = [{'checksum': checksum, 'file': fake_file.basename}] dl_dir = tmpdir.mkdir('download') req.get('https://fake/path/fake_rm.out.gz', text=fake_file.read()) assert core.worker(core.download_file_job(entry, str(dl_dir), checksums, 'rm'))
def test_download_file_symlink_path(req, tmpdir): entry = {'ftp_path': 'ftp://fake/path'} fake_file = tmpdir.join('fake_genomic.gbff.gz') fake_file.write('foo') assert fake_file.check() checksum = core.md5sum(str(fake_file)) checksums = [{'checksum': checksum, 'file': fake_file.basename}] dl_dir = tmpdir.mkdir('download') symlink_dir = tmpdir.mkdir('symlink') req.get('https://fake/path/fake_genomic.gbff.gz', text=fake_file.read()) assert core.worker( core.download_file_job(entry, str(dl_dir), checksums, symlink_path=str(symlink_dir))) symlink = symlink_dir.join('fake_genomic.gbff.gz') assert symlink.check()
def test_download_file_symlink_path(req, tmpdir): entry = {'ftp_path': 'ftp://fake/path'} fake_file = tmpdir.join('fake_genomic.gbff.gz') fake_file.write('foo') assert fake_file.check() checksum = core.md5sum(str(fake_file)) checksums = [{'checksum': checksum, 'file': fake_file.basename}] dl_dir = tmpdir.mkdir('download') symlink_dir = tmpdir.mkdir('symlink') req.get('https://fake/path/fake_genomic.gbff.gz', text=fake_file.read()) assert core.worker( core.download_file_job(entry, str(dl_dir), checksums, symlink_path=str(symlink_dir))) symlink = symlink_dir.join('fake_genomic.gbff.gz') assert symlink.check()
def test_download_file_fasta(req, tmpdir): entry = {'ftp_path': 'ftp://fake/path'} bogus_file = tmpdir.join('fake_cds_from_genomic.fna.gz') bogus_file.write("we don't want this one") bogus_checksum = core.md5sum(str(bogus_file)) fake_file = tmpdir.join('fake_genomic.fna.gz') fake_file.write('foo') assert fake_file.check() checksum = core.md5sum(str(fake_file)) checksums = [ {'checksum': bogus_checksum, 'file': bogus_file.basename}, {'checksum': checksum, 'file': fake_file.basename}, ] dl_dir = tmpdir.mkdir('download') req.get('https://fake/path/fake_genomic.fna.gz', text=fake_file.read()) assert core.worker(core.download_file_job(entry, str(dl_dir), checksums, 'fasta'))
def test_download_file_fasta(req, tmpdir): entry = {'ftp_path': 'ftp://fake/path'} bogus_file = tmpdir.join('fake_cds_from_genomic.fna.gz') bogus_file.write("we don't want this one") bogus_checksum = core.md5sum(str(bogus_file)) fake_file = tmpdir.join('fake_genomic.fna.gz') fake_file.write('foo') assert fake_file.check() checksum = core.md5sum(str(fake_file)) checksums = [ {'checksum': bogus_checksum, 'file': bogus_file.basename}, {'checksum': checksum, 'file': fake_file.basename}, ] dl_dir = tmpdir.mkdir('download') req.get('https://fake/path/fake_genomic.fna.gz', text=fake_file.read()) assert core.worker(core.download_file_job(entry, str(dl_dir), checksums, 'fasta'))