예제 #1
0
 def test_insert_db(self):
     result = [1, unicode('name'), 100, 100, unicode('photo')]
     with app.app_context():
         self.database.query_db('insert into spots (name, latitude, longitude, photo) values (?, ?, ?, ?)', ['name', 100, 100, 'photo'])
         row = self.database.query_db('select * from spots')[0]
         res = [row[r] for r in row.keys()]
         assert res == result
예제 #2
0
 def test_delete_db(self):
     id = 1
     with app.app_context():
         self.database.query_db('insert into spots (name, latitude, longitude, photo) values (?, ?, ?, ?)', ['name', 100, 100, 'photo'])
         before = self.database.query_db('select * from spots')[0]
         self.database.query_db('delete from spots where id=?', [id])
         after = self.database.query_db('select * from spots')
         assert [before[r] for r in before.keys()] == [1, unicode('name'), 100, 100, unicode('photo')]
         assert after == []