Skip to content

Commit

Permalink
test create blast db
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosp420 committed Jan 3, 2015
1 parent 53a3b0a commit 5e52ca5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions voseq/blast_local/tests.py
@@ -1,5 +1,7 @@
import glob
import os

from django.core.management import call_command
from django.test import TestCase
from django.conf import settings

Expand All @@ -8,10 +10,16 @@

class BlastLocalTest(TestCase):
def setUp(self):
args = []
opts = {'dumpfile': 'test_db_dump.xml'}
cmd = 'migrate_db'
call_command(cmd, *args, **opts)

blast_type = 'local'
voucher_code = 'CP100-10'
gene_code = 'COI'
self.blast = BLAST(blast_type, voucher_code, gene_code)
self.seq_file = ''

def test_have_blast_db(self):
result = self.blast.have_blast_db()
Expand All @@ -35,7 +43,13 @@ def test_save_seqs_to_file(self):
self.assertTrue(result)

def test_create_blast_db(self):
self.blast.save_seqs_to_file()
self.blast.create_blast_db()

def tearDown(self):
os.remove(self.seq_file)
files = glob.glob(
os.path.join(settings.BASE_DIR,
'..',
'blast_local',
'db',
'COI_seqs.fas.n*')
)
self.assertTrue(len(files) > 0)

0 comments on commit 5e52ca5

Please sign in to comment.