예제 #1
0
 def test_paging_query_3(self):
     args = MultiDict([('page', '1')])
     query = getSortAndPageQuery(Restaurant.query, args, Restaurant)
     response = query.all()
     self.assertTrue(len(response) <= 12)
     for place in response:
         self.assertTrue(isinstance(place, Restaurant))
예제 #2
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)
예제 #3
0
 def test_paging_query_1(self):
     args = MultiDict([('page', '1')])
     query = getSortAndPageQuery(Attraction.query, args, Attraction)
     response = query.all()
     self.assertTrue(len(response) <= 12)
     for place in response:
         self.assertTrue(isinstance(place, Attraction))
예제 #4
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)
예제 #5
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)
예제 #6
0
 def test_search_query_5(self):
     args = MultiDict([('search', 'Austin')])
     query = getSearchQuery(args, Attraction)
     response = query.all()
     for place in response:
         self.assertTrue(isinstance(place, Attraction))
         self.assertTrue("austin" in place.name.lower()
                         or "austin" in str(place.zipcode))
예제 #7
0
 def test_search_query_1(self):
     args = MultiDict([('search', 'taco')])
     query = getSearchQuery(args, Restaurant)
     response = query.all()
     for place in response:
         self.assertTrue(isinstance(place, Restaurant))
         self.assertTrue("taco" in place.name.lower()
                         or "taco" in str(place.zipcode))
예제 #8
0
 def test_sorting_query_6(self):
     args = MultiDict([('order_by', 'name'), ('order', 'desc')])
     query = getSortAndPageQuery(Restaurant.query, args, Restaurant)
     response = query.all()
     pre_name = response[0].name
     for place in response:
         self.assertTrue(isinstance(place, Restaurant))
         self.assertTrue(pre_name >= place.name)
         pre_name = place.name
예제 #9
0
 def test_sorting_query_5(self):
     args = MultiDict([('order_by', 'rating'), ('order', 'asc')])
     query = getSortAndPageQuery(Restaurant.query, args, Restaurant)
     response = query.all()
     pre_rating = response[0].rating
     for place in response:
         self.assertTrue(isinstance(place, Restaurant))
         self.assertTrue(pre_rating <= place.rating)
         pre_rating = place.rating
예제 #10
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)
예제 #11
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)
예제 #12
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)
예제 #13
0
 def test_search_query_6(self):
     args = MultiDict([('search', 'austin,78701'), ('search_type', 'and')])
     query = getSearchQuery(args, Attraction)
     response = query.all()
     for place in response:
         self.assertTrue(isinstance(place, Attraction))
         name_check = "austin" in place.name.lower(
         ) or "78701" in place.name.lower()
         zipcode_check = "austin" in str(place.zipcode) or "78701" in str(
             place.zipcode)
         self.assertTrue(name_check and zipcode_check)
예제 #14
0
 def test_search_query_2(self):
     args = MultiDict([('search', 'taco,78701'), ('search_type', 'and')])
     query = getSearchQuery(args, Restaurant)
     response = query.all()
     for place in response:
         self.assertTrue(isinstance(place, Restaurant))
         name_check = "taco" in place.name.lower(
         ) or "78701" in place.name.lower()
         zipcode_check = "taco" in str(place.zipcode) or "78701" in str(
             place.zipcode)
         self.assertTrue(name_check and zipcode_check)