Ejemplo n.º 1
0
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);
Ejemplo n.º 2
0
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()
Ejemplo n.º 3
0
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)
Ejemplo n.º 4
0
    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)
Ejemplo n.º 5
0
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);
Ejemplo n.º 6
0
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)
Ejemplo n.º 7
0
 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)
Ejemplo n.º 8
0
 def test_rest_default_location(self):
     rest = Restaurant(restaurant_ID=14351)
     rest.save()
     self.assertEqual(((rest.lat, rest.lng)), (55.8642, -4.2518))
Ejemplo n.º 9
0
 def test_create_rest(self):
     rest1 = Restaurant(restaurant_ID=14214)
     rest1.save()
     self.assertTrue(rest1)