Skip to content

Commit fa2392c

Browse files
committed
Adding tests for test_build_biom_tables
1 parent 7a29adc commit fa2392c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

qiita_db/test/test_analysis.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,7 @@ def test_build_mapping_file_duplicate_samples(self):
423423
conn_handler=self.conn_handler)
424424

425425
def test_build_biom_tables(self):
426+
new_id = get_count('qiita.filepath') + 1
426427
samples = {1: ['1.SKB8.640193', '1.SKD8.640184', '1.SKB7.640196']}
427428
self.analysis._build_biom_tables(samples, 100,
428429
conn_handler=self.conn_handler)
@@ -441,6 +442,17 @@ def test_build_biom_tables(self):
441442
'Processed_id': 1}
442443
self.assertEqual(obs, exp)
443444

445+
sql = """SELECT EXISTS(SELECT * FROM qiita.filepath
446+
WHERE filepath_id=%s)"""
447+
obs = self.conn_handler.execute_fetchone(sql, (new_id,))[0]
448+
449+
self.assertTrue(obs)
450+
451+
sql = """SELECT * FROM qiita.analysis_filepath
452+
WHERE analysis_id=%s ORDER BY filepath_id"""
453+
obs = self.conn_handler.execute_fetchall(sql, (self.analysis.id,))
454+
exp = [[1L, 14L, 2L], [1L, 15L, None], [1L, new_id, None]]
455+
444456
def test_build_files(self):
445457
self.analysis.build_files()
446458

0 commit comments

Comments
 (0)