def testImportCityFromCSVRow(self): row = ['Toronto', 'Ontario', 'Canada'] City.import_from_csv_row(row) city = list(City.query())[0] self.assertEqual(city.name, 'Toronto') self.assertEqual(city.region, 'Ontario') self.assertEqual(city.country, 'Canada') self.assertEqual(city.nearby_cities, [])
def testImportCitiesFromCSVFile(self): rows = [ ['City', 'Region', 'Country'], ['Toronto', 'Ontario', 'Canada'], ] csvfile = [','.join(row) for row in rows] City.import_from_csv(csvfile) city = list(City.query())[0] self.assertEqual(city.name, 'Toronto') self.assertEqual(city.region, 'Ontario') self.assertEqual(city.country, 'Canada')