Ejemplo n.º 1
0
 def testCheckTableExists(self):
     """If database exists, connect and check if traces table exists."""
     # create a dummy table
     con, cur = dbms.connect(DB)
     cur.execute("create table traces(id int)")
     con.commit()
     con.close()
     # don't create it again
     created = dbms.create_traces_table(DB)
     self.assertFalse(created)
Ejemplo n.º 2
0
    def testSaveFinished(self):
        """Save new entry as finished"""
        dbms.create_traces_table(DB)
        con, cur = dbms.connect(DB)

        key, gene = ("PS48104-1", "CRISPR1")
        # entry does not exist
        cur.execute("select id from traces where key=? and gene=?",
                    (key, gene))
        self.assertEqual(len(cur.fetchall()), 0)

        # save as finished
        cur.execute("insert into traces(key, gene, status) values (?, ?, ?)",
                    (key, gene, "Finished"))

        # check only 1 entry exists
        cur.execute("select count(*) from traces where key=? and gene=?",
                    (key, gene))
        self.assertEqual(cur.fetchone()[0], 1)
        con.commit()
        con.close()
Ejemplo n.º 3
0
 def testCreateTable(self):
     """If database is new, create traces table and return status T/F."""
     created = dbms.create_traces_table(DB)
     self.assertTrue(created)