def test_commit(self): obj = DB() row = {'name': 'Ram', 'occupation': 'web development'} row_id = obj.insert_row(row) obj.commit() obj2 = DB() self.assertEqual(len(obj2.data), 1)
def import_from_file(self, input_file): quotes = json.load(input_file) db_path = self.get_config('DB_PATH') db_obj = DB(db_path) for quote in quotes: db_obj.insert_row(quote) db_obj.commit() db_obj.close() print("Imported from the given file")