Example #1
0
class TestNcbiBlast(TestCase):
    def setUp(self):
        args = []
        opts = {
            'dumpfile': settings.MEDIA_ROOT + 'test_data.xml',
            'verbosity': 0
        }
        cmd = 'migrate_db'
        call_command(cmd, *args, **opts)

        self.blast = BLASTNcbi(blast_type="remote",
                               voucher_code="CP100-10",
                               gene_code="COI-begin")

    @patch("Bio.Blast.NCBIWWW.qblast", return_value=ncbi_return_handle1)
    def test_blast_with_accession_number_in_header(self, mock_qblast):
        self.blast.save_query_to_file()
        self.blast.do_blast()
        result = self.blast.parse_blast_output()
        self.blast.delete_query_output_files()
        self.assertTrue(len(result) > 0)

    @patch("Bio.Blast.NCBIWWW.qblast", return_value=ncbi_return_handle2)
    def test_index(self, mock_blast):
        response = self.client.get('/blast_ncbi/CP100-10/COI-begin/')
        self.assertEqual(200, response.status_code)
Example #2
0
class TestNcbiBlast(TestCase):
    def setUp(self):
        args = []
        opts = {'dumpfile': 'test_db_dump.xml', 'verbosity': 0}
        cmd = 'migrate_db'
        call_command(cmd, *args, **opts)

        voucher_code = 'CP100-10'
        gene_code = 'COI'
        self.blast = BLASTNcbi(voucher_code, gene_code)

    @unittest.skipIf(settings.TRAVIS is True,
                     'Testing using BLASTNcbi fails due to network problems')
    def test_blast_with_accession_number_in_header(self):
        self.blast.save_query_to_file()
        self.blast.do_blast()
        result = self.blast.parse_blast_output()
        self.blast.delete_query_output_files()
        self.assertTrue(len(result) > 0)

    @unittest.skipIf(settings.TRAVIS is True,
                     'Testing using BLASTNcbi fails due to network problems')
    def test_index(self):
        response = self.client.get('/blast_ncbi/CP100-10/COI/')
        self.assertEqual(200, response.status_code)
Example #3
0
class TestNcbiBlast(TestCase):
    def setUp(self):
        args = []
        opts = {'dumpfile': 'test_db_dump.xml', 'verbosity': 0}
        cmd = 'migrate_db'
        call_command(cmd, *args, **opts)

        voucher_code = 'CP100-10'
        gene_code = 'COI'
        self.blast = BLASTNcbi(voucher_code, gene_code)

    def test_blast_with_accession_number_in_header(self):
        self.blast.save_query_to_file()
        self.blast.do_blast()
        result = self.blast.parse_blast_output()
        self.blast.delete_query_output_files()
        self.assertTrue(len(result) > 0)

    def test_index(self):
        response = self.client.get('/blast_ncbi/CP100-10/COI/')
        self.assertEqual(200, response.status_code)
Example #4
0
class TestNcbiBlast(TestCase):
    def setUp(self):
        args = []
        opts = {'dumpfile': 'test_db_dump2.xml', 'verbosity': 0}
        cmd = 'migrate_db'
        call_command(cmd, *args, **opts)

        self.blast = BLASTNcbi(blast_type="remote", voucher_code="CP100-10",
                               gene_code="COI-begin")

    @patch("Bio.Blast.NCBIWWW.qblast", return_value=ncbi_return_handle1)
    def test_blast_with_accession_number_in_header(self, mock_qblast):
        self.blast.save_query_to_file()
        self.blast.do_blast()
        result = self.blast.parse_blast_output()
        self.blast.delete_query_output_files()
        self.assertTrue(len(result) > 0)

    @patch("Bio.Blast.NCBIWWW.qblast", return_value=ncbi_return_handle2)
    def test_index(self, mock_blast):
        response = self.client.get('/blast_ncbi/CP100-10/COI-begin/')
        self.assertEqual(200, response.status_code)