def test_handler_add_stops_from_file_inserts_one_record(self,
                                                         mock_init_db):
     handler = DatabaseHandler('unit_test_db.sqlite3')
     with open('test_file.csv', 'w') as f:
         f.write('latitude,longitude\n')
         f.write('15.35,-1.5\n')
     handler.add_stops_from_file('test_file.csv')
     c = handler.conn.cursor()
     c.execute("SELECT latitude, longitude FROM stops")
     row = c.fetchone()
     self.assertEqual((15.35, -1.5), row)
Пример #2
0
 def test_handler_add_stops_from_file_inserts_one_record(
         self, mock_init_db):
     handler = DatabaseHandler('unit_test_db.sqlite3')
     with open('test_file.csv', 'w') as f:
         f.write('latitude,longitude\n')
         f.write('15.35,-1.5\n')
     handler.add_stops_from_file('test_file.csv')
     c = handler.conn.cursor()
     c.execute("SELECT latitude, longitude FROM stops")
     row = c.fetchone()
     self.assertEqual((15.35, -1.5), row)