def setUp(self): main.app.testing = True self.app = main.app.test_client() self.userIds = ["testuid1", "testuid2"] self.from_location = LocationFactory.from_pickup_address( "Tenaya Hall, San Diego, CA 92161") self.from_location.save() self.to_location = LocationFactory.from_pickup_address( "Tioga Hall, San Diego, CA 92161") self.to_location.save() self.ride_host = RideHost.new(doc_id="tmp_ride_host_1", earliest_departure=1419851578, from_location=self.from_location, to_location=self.to_location, user_id="testuid1", status="created") self.ride_host.save() self.rider_booking = RiderBooking.new( doc_id="tmp_rider_booking_1", earliest_departure=1419851578, from_location=self.from_location, to_location=self.to_location, user_id="xHU5Hp8OJbVitZEWPlWk3VGyC8I3", status="created") self.rider_booking.save()
def setUp(self): main.app.testing = True self.app = main.app.test_client() self.userIds = ["testuid1", "testuid2"] self.from_location: UserLocation = LocationFactory.from_pickup_address("Tenaya Hall, San Diego, CA 92161") self.from_location.save() self.sublocation = Sublocation.get_with_latlng( latitude=self.from_location.latitude, longitude=self.from_location.longitude ) self.sublocation.save() testing_utils._wait() UserLocation.add_sublocation_with_id( self.from_location.doc_id, [self.sublocation.doc_id], ) self.to_location = LocationFactory.from_pickup_address("Tioga Hall, San Diego, CA 92161") self.to_location.save() testing_utils._wait() UserLocation.add_sublocation_with_id( self.to_location.doc_id, [self.sublocation.doc_id] ) self.users = { user_id: User.new(doc_id=user_id, name="My Name", email=f"{user_id}@myemail.com") for user_id in self.userIds } _ = [user.save() for _, user in self.users.items()] self.ride_host = RideHost.new( doc_id="tmp_ride_host_1", earliest_departure=1419851578, from_location=self.from_location, to_location=self.to_location, user_id=self.userIds[0], status="created" ) self.ride_host.save() self.rider_booking = RiderBooking.new( doc_id="tmp_rider_booking_1", earliest_departure=1419851578, from_location=self.from_location, to_location=self.to_location, user_id=self.userIds[1], status="created" ) self.rider_booking.save()
def setUp(self): # main.app.testing = True # self.app = main.app.test_client() self.userIds = ["testuid1", "testuid2"] self.users = { user_id: User.new(doc_id=user_id, name="My Name", email=f"{user_id}@myemail.com") for user_id in self.userIds } _ = [user.save() for _, user in self.users.items()] self.host_from = LocationFactory.from_place_address( "8775 Costa Verde Blvd, San Diego, CA 92122") self.host_from.user_id = self.userIds[0] self.host_from.save() self.host_to = LocationFactory.from_place_address( "Center Hall, San Diego, CA") self.host_to.user_id = self.userIds[0] self.host_to.save() self.rider_from = LocationFactory.from_place_address( "3915 Nobel Drive, San Diego, CA") a = Sublocation.get_with_latlng( latitude=self.rider_from.coordinates["latitude"], longitude=self.rider_from.coordinates["longitude"]) a.save() self.a = a self.rider_from.sublocations = [a.doc_ref] self.rider_from.user_id = self.userIds[1] self.rider_from.save() self.rider_to = LocationFactory.from_place_address( "Center Hall, San Diego, CA") b = Sublocation.get_with_latlng( latitude=self.rider_to.coordinates["latitude"], longitude=self.rider_to.coordinates["longitude"]) b.save() self.b = b self.rider_to.sublocations = [b.doc_ref] self.rider_to.user_id = self.userIds[1] self.rider_to.save() self.ride_host = RideHost.new( doc_id="tmp_ride_host_1", earliest_departure=fields.timestamp_from_local_time( "2020-04-09T10:55:00"), from_location=self.host_from, to_location=self.host_to, user_id=self.userIds[0], status="created") self.ride_host.save() self.rider_booking = RiderBooking.new( doc_id="tmp_rider_booking_1", earliest_departure=fields.timestamp_from_local_time( "2020-04-09T11:00:00"), from_location=self.rider_from, to_location=self.rider_to, user_id=self.userIds[1], status="created") self.rider_booking.save()