def test_init_db( self ): self.assertTrue( not os.path.isfile( dbfl ) ) piubsl.init_db( self.args ) self.assertTrue( os.path.isfile( dbfl ) ) ctm = os.path.getctime( dbfl ) time.sleep( 0.001 ) piubsl.init_db( self.args ) self.assertNotEqual( ctm, os.path.getctime( dbfl ) )
def test_add_entry( self ): piubsl.init_db( self.args ) conn = sqlite3.connect( dbfl ) c = conn.cursor() piubsl.add_entry( c, ("foo", [], [ "sym1", "sym2" ]) ) conn.commit() piubsl.add_entry( c, ("bar", [], [ "sym1", "sym3" ]) ) conn.commit() with self.assertRaises( BaseException ): piubsl.add_entry( c, ("bar", [], [ "sym1", "sym3" ]) ) conn.commit()