def test_result_notified_unavailable_updates_apartment_and_listings(): listing_id = listing_service.create_listing(**result_test_data.cl_listing_4033538277).id search_id = search_service.create_search(**result_test_data.search_1).id listing = Listing.objects.get(pk=listing_id) apartment = listing.apartment search = Search.objects.get(pk=search_id) result_id = result_service.create_result(apartment, search).id result = Result.objects.get(pk=result_id) result.add_availability_response('This is a test', timezone.now(), Availability.objects.get_unavailable_type()) result_service.save_or_update(result) apartment = apartment_service.get_apartment(apartment.pk) assert apartment.is_available == False listings = apartment.listings.values_list('is_deleted', flat=True) assert all(f == True for f in listings)
def test_result_creates_correct_compliance_score(): listing = listing_service.create_listing(**result_test_data.cl_listing_4033538277) listing = Listing.objects.get(pk=listing.id) apartment = listing.apartment apartment.amenities.add(ApartmentAmenity(amenity_type_id=1, is_available=True), ApartmentAmenity(amenity_type_id=2, is_available=True), ApartmentAmenity(amenity_type_id=3, is_available=False)) search = search_service.create_search(**result_test_data.search_1) result = result_service.create_result(apartment, search) assert result.compliance_score == 60
def test_result_is_created_from_attrs(): listing_id = listing_service.create_listing(**result_test_data.cl_listing_4033538277).id search_id = search_service.create_search(**result_test_data.search_1).id listing = Listing.objects.get(pk=listing_id) apartment = listing.apartment search = Search.objects.get(pk=search_id) result_id = result_service.create_result(apartment, search).id result = Result.objects.get(pk=result_id) assert 1 == Result.objects.count()
def test_search_is_created_from_attrs(): search_id = search_service.create_search(**search_test_data.search_1).id search = Search.objects.get(pk=search_id) assert 1 == Search.objects.count()