def setup_function(function): cuisine = Cuisine(name="vietnamese") cuisine.save() restaurant = Restaurant(name="tu lan", location="123 address", cuisine=cuisine) restaurant.save() food = Food(**{ "name": "Pho bo", "cuisine": cuisine, "restaurant": restaurant, "price": 8.75, "avgRating": 4.5, "numRating": 10 }) food.save() userChew = User(user="******") userChew.save() userHungry = User(user="******") userHungry.save() review = Review(**{ "food": food, "text": "Wow this was delicious!", "user": userChew, "foodRating": 4, "reviewRating": 0, }) review.save() reviewTwo = Review(**{ "food": food, "text": "Wow this was delicious!", "user": userHungry, "foodRating": 4, "reviewRating": 0, }) reviewTwo.save() function.parametrize(review);
def setup_function(function): Food.objects.all.delete() cuisine = Cuisine(name="vietnamese") cuisine.save() restaurant = Restaurant(name="tu lan", location="123 address", cuisine=cuisine) restaurant.save() food = Food(**{ "name": "Pho bo", "cuisine": cuisine, "restaurant": restaurant, "price": 8.75, "avgRating": 4.5, "numRating": 10 }) food.save()
def setup_function(function): Food.objects.all.delete() cuisine = Cuisine(name="vietnamese") cuisine.save() restaurant = Restaurant(name="tu lan", location="123 address", cuisine=cuisine) restaurant.save() food = Food(**{ "name": "Pho bo", "cuisine": cuisine, "restaurant": restaurant, "price": 8.75, "avgRating": 4.5, "numRating": 10 }) food.save() function.parametrize(food)
def handle(self, *args, **options): url = 'http://mob.snu.ac.kr/api/M/new/findRestList.action' res = requests.post(url).json()['GRD_SNUCO_RESTAURANT'] rs = [ Restaurant(code=int(r['code']), name=r['restaurant']) for r in res ] Restaurant.objects.bulk_create(rs)
def setup_function(function): cuisine = Cuisine(name="vietnamese") cuisine.save() restaurant = Restaurant(name="tu lan", location="123 address", cuisine=cuisine) restaurant.save() food = Food(**{ "name": "Pho bo", "cuisine": cuisine, "restaurant": restaurant, "price": 8.75, "avgRating": 4.5, "numRating": 10 }) food.save() image = Image(**{ "food": food, "image": "/images/001.jpg", }) image.save() function.parametrize(image);
def setup_function(function): cuisine = Cuisine(name="vietnamese") cuisine.save() restaurant = Restaurant(name="tu lan", location="123 address", cuisine=cuisine) restaurant.save() food = Food( **{ "name": "Pho bo", "cuisine": cuisine, "restaurant": restaurant, "price": 8.75, "avgRating": 4.5, "numRating": 10 }) food.save() image = Image(**{ "food": food, "image": "/images/001.jpg", }) image.save() function.parametrize(image)
def test_create_com(self): rest = Restaurant(restaurant_ID=14214) rest.save() com = Comment(review_ID=51453, rating=3, price=3, restaurant=rest) com.save() self.assertTrue(com)
def test_rest_default_location(self): rest = Restaurant(restaurant_ID=14351) rest.save() self.assertEqual(((rest.lat, rest.lng)), (55.8642, -4.2518))
def test_create_rest(self): rest1 = Restaurant(restaurant_ID=14214) rest1.save() self.assertTrue(rest1)