Example #1
0
 def test_rating_filter_query_3(self):
     args = MultiDict([('rating', '4')])
     query = getFilterQuery(Attraction.query, args, Attraction)
     response = query.all()
     for place in response:
         self.assertTrue(isinstance(place, Attraction))
         self.assertTrue(place.rating >= 4)
Example #2
0
 def test_rating_filter_query_2(self):
     args = MultiDict([('rating', '4')])
     query = getFilterQuery(Restaurant.query, args, Restaurant)
     response = query.all()
     for place in response:
         self.assertTrue(isinstance(place, Restaurant))
         self.assertTrue(place.rating >= 4)
Example #3
0
 def test_zipcode_filter_query_2(self):
     args = MultiDict([('zipcode', '78701')])
     query = getFilterQuery(Hotel.query, args, Hotel)
     response = query.all()
     for place in response:
         self.assertTrue(isinstance(place, Hotel))
         self.assertEqual(place.zipcode, 78701)
Example #4
0
 def test_categories_filter_query_6(self):
     args = MultiDict([('categories', 'hiking,parks')])
     query = getFilterQuery(Attraction.query, args, Attraction)
     response = query.all()
     for place in response:
         self.assertTrue(isinstance(place, Attraction))
         haveCategories = False
         for assoc in place.categories:
             haveCategories = haveCategories or assoc.category_id == "hiking" or assoc.category_id == "parks"
         self.assertTrue(haveCategories)
Example #5
0
 def test_categories_filter_query_4(self):
     args = MultiDict([('categories', 'musicvenues,divebars')])
     query = getFilterQuery(Hotel.query, args, Hotel)
     response = query.all()
     for place in response:
         self.assertTrue(isinstance(place, Hotel))
         haveCategories = False
         for assoc in place.categories:
             haveCategories = haveCategories or assoc.category_id == "musicvenues" or assoc.category_id == "divebars"
         self.assertTrue(haveCategories)
Example #6
0
 def test_categories_filter_query_2(self):
     args = MultiDict([('categories', 'japanese,cocktailbars')])
     query = getFilterQuery(Restaurant.query, args, Restaurant)
     response = query.all()
     for place in response:
         self.assertTrue(isinstance(place, Restaurant))
         haveCategories = False
         for assoc in place.categories:
             haveCategories = haveCategories or assoc.category_id == "japanese" or assoc.category_id == "cocktailbars"
         self.assertTrue(haveCategories)