def test_filter_zap_squareMeter_without_usableAreas(self): listing = create_object_Listing_for_sale_with_price_800000() listing.usableAreas = 0 listings = [listing] zap_filtered_listings = filters.listings_zap_filter(listings) self.assert_(len(zap_filtered_listings) == 1)
def test_filter_inside_zap_area_with_price_greater_than_540000(self): listing = ( create_object_Listing_for_sale_with_price_550000_inside_zap_area() ) listings = [listing] zap_filtered_listings = filters.listings_zap_filter(listings) self.assert_(len(zap_filtered_listings) == 1)
def test_filter_zap_squareMeter_with_square_meter_price_lower_than_3500( self ): listing = create_object_Listing_for_sale_with_price_400000() listings = [listing] zap_filtered_listings = filters.listings_zap_filter(listings) self.assert_(len(zap_filtered_listings) == 0)
def test_filter_outside_zap_area_with_price_greater_than_540000(self): listing = ( create_object_Listing_for_sale_with_price_550000_inside_zap_area() ) listing.address.geoLocation.location.lat = -23.628169 listing.address.geoLocation.location.lon = -46.864586 listings = [listing] zap_filtered_listings = filters.listings_zap_filter(listings) self.assert_(len(zap_filtered_listings) == 0)
def get_queryset(self): if not cache.is_file_complete(): raise ServiceUnavailable() listings = Listing.get_all() portal = self.request.query_params.get("portal", None) if portal == "zap": listings = filters.listings_zap_filter(listings) if portal == "vivareal": listings = filters.listings_vivareal_filter(listings) return listings
def test_filter_zap_rental_price_lower_than_3500(self): listing = create_object_Listing_for_rental_with_price_2500() listings = [listing] zap_filtered_listings = filters.listings_zap_filter(listings) self.assert_(len(zap_filtered_listings) == 0)
def test_filter_zap_sale_price_greater_than_600000(self): listing = create_object_Listing_for_sale_with_price_800000() listings = [listing] zap_filtered_listings = filters.listings_zap_filter(listings) self.assert_(len(zap_filtered_listings) == 1)