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)
예제 #2
0
def notify_results_unavailable_task(apartment_id, reason):
  apartment = apartment_service.get_apartment(apartment_id)

  return result_service.notify_results_unavailable(apartment, reason)
예제 #3
0
def associate_listing_with_apartment_task(listing_id, apartment_id):
  listing = listing_service.get_listing(listing_id)
  apartment = apartment_service.get_apartment(apartment_id)
  return listing_service.associate_listing_with_apartment(listing, apartment).id
예제 #4
0
def notify_listings_unavailable_task(apartment_id):
  apartment = apartment_service.get_apartment(apartment_id)
  return listing_service.notify_listings_unavailable(apartment)
예제 #5
0
def handle_result_notification_task(apartment_id, availability_type_system_name):
  apartment = apartment_service.get_apartment(apartment_id)
  apartment_service.handle_result_notification(apartment, availability_type_system_name)