def test_filter_rental_with_condo_fee_equals_30_percent(self): listing = ( create_object_Listing_for_rental_with_price_1000_and_condo_fee_300() ) listings = [listing] zap_filtered_listings = filters.listings_vivareal_filter(listings) self.assert_(len(zap_filtered_listings) == 0)
def test_filter_rental_with_condo_fee_equals_29_percent(self): listing = ( create_object_Listing_for_rental_with_price_1000_and_condo_fee_300() ) listing.pricingInfos.monthlyCondoFee = 290 listings = [listing] zap_filtered_listings = filters.listings_vivareal_filter(listings) self.assert_(len(zap_filtered_listings) == 1)
def test_filter_vivareal_inside_zap_area_with_price_greater_than_540000( self ): listing = ( create_object_Listing_for_rental_with_price_5000_inside_zap_area() ) listings = [listing] zap_filtered_listings = filters.listings_vivareal_filter(listings) self.assert_(len(zap_filtered_listings) == 1)
def test_filter_vivareal_sale_price_lower_than_700000_with_invalid_location( self ): listing = create_object_Listing_for_sale_with_price_400000() listing.address.geoLocation.location.lat = 0 listing.address.geoLocation.location.lon = 0 listings = [listing] zap_filtered_listings = filters.listings_vivareal_filter(listings) self.assert_(len(zap_filtered_listings) == 0)
def test_filter_vivareal_outside_zap_area_with_price_greater_than_540000( self ): listing = ( create_object_Listing_for_rental_with_price_5000_inside_zap_area() ) listing.address.geoLocation.location.lat = -23.628169 listing.address.geoLocation.location.lon = -46.864586 listings = [listing] zap_filtered_listings = filters.listings_vivareal_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_vivareal_rental_price_lower_than_4000(self): listing = create_object_Listing_for_rental_with_price_2500() listings = [listing] zap_filtered_listings = filters.listings_vivareal_filter(listings) self.assert_(len(zap_filtered_listings) == 1)
def test_filter_vivareal_sale_price_greater_than_700000(self): listing = create_object_Listing_for_sale_with_price_800000() listings = [listing] zap_filtered_listings = filters.listings_vivareal_filter(listings) self.assert_(len(zap_filtered_listings) == 0)