def test_write_entry(self): expected = ("My Title", "My Text") with self.app.test_request_context('/'): microblog.write_entry(*expected) con = microblog.connect_db() cur = con.execute("select * from entries;") rows = cur.fetchall() self.assertEquals(len(rows), 1) for val in expected: self.assertTrue(val in rows[0])
def test_database_setup(self): con = microblog.connect_db() cur = con.execute('PRAGMA table_info(entries);') rows = cur.fetchall() self.assertEquals(len(rows), 3)