def setUp(self):
        eventDict = getEventDict()
        self.event = Event.from_dict(eventDict)
        self.refs_to_delete = list()

        self.cl = setup_scripts.SetUpTestDatabase()
        self.cl.clear_before()

        self.pl = setup_scripts.scripts.populate_locations.PopulateLocationCommand(
        )
        self.refs_to_delete.extend(self.pl.execute())
        self.fb_event = Event.from_dict(getEventDict(event_category="social"))
示例#2
0
    def setUp(self):

        self.refs_to_delete = list()

        event_dict = getEventDict(use_firestore_ref=True,
                                  to_earliest=1545033600,
                                  to_latest=1545119999,
                                  from_earliest=1545033600,
                                  from_latest=1545119999)

        self.event = Event.from_dict(event_dict)

        main.app.testing = True
        self.app = main.app.test_client()
        self.userId = "testuid1"

        self.c = scripts.SetUpTestDatabase()
        self.c.clear_before()
        self.c.generate_test_data(start_string="2018-12-17T08:00:00.000", num_days=5)

        # Populate location
        location_ref = event_dict["locationRef"]
        location_d = getLocationDict(location_category="social")
        location = Location.from_dict(location_d)
        LocationGenericDao().set(location, location_ref)
        self.refs_to_delete.append(location_ref)

        event_ref: firestore.DocumentReference = EventDao().create(self.event)
        self.event.set_firestore_ref(event_ref)
        self.refs_to_delete.append(event_ref)
        self.event_id = event_ref.id
示例#3
0
def update_in_orbit_event_schedule(transaction: Transaction,
                                   ride_request: Type[RideRequest],
                                   orbit: Orbit, event: Event,
                                   location: Location):
    """ Populate eventSchedule (client view model)
    :param transaction:
    :param ride_request:
    :param orbit:
    :param event:
    :param location:
    :return:
    """

    # update eventSchedule
    user_id = ride_request.user_id
    user_ref = UserDao().get_ref(user_id)
    event_ref = event.get_firestore_ref()

    event_schedule = event_schedule_actions.create_event_schedule_orbit(
        ride_request=ride_request, location=location, orbit=orbit)
    UserDao().add_to_event_schedule_with_transaction(
        transaction,
        user_ref=user_ref,
        event_ref=event_ref,
        event_schedule=event_schedule)
示例#4
0
 def setUp(self):
     event_dict = store.getEventDict(event_category="social")
     event = Event.from_dict(event_dict)
     event_ref = EventDao().create(event)
     self.refs_to_delete.append(event_ref)
     self.event_id = event_ref.id
     d = store.EventRideRequestFormDictFactory().create(
         event_id=self.event_id, add_earliest_latest=True)
     self.user_id = 'testuserid1'
     self.builder: SocialEventRideRequestBuilder = \
         SocialEventRideRequestBuilder().set_with_form_and_user_id(d, user_id=self.user_id)
示例#5
0
def update_not_in_orbit_event_schedule(transaction: Transaction,
                                       ride_request: RideRequest, event: Event,
                                       location: Location):
    # update eventSchedule
    user_id = ride_request.user_id
    user_ref = UserDao().get_ref(user_id)
    event_ref = event.get_firestore_ref()

    event_schedule = event_schedule_actions.create_event_schedule(
        ride_request, location)
    UserDao().add_to_event_schedule_with_transaction(
        transaction,
        user_ref=user_ref,
        event_ref=event_ref,
        event_schedule=event_schedule)
    def setUp(self):
        main.app.testing = True
        self.app = main.app.test_client()
        self.userIds = ["testuid1", "testuid2"]

        self.refs_to_delete = list()

        location_dict = store.getLocationDict(location_category="social")
        location = Location.from_dict(location_dict)
        location_ref = LocationGenericDao().insert_new(location)
        self.refs_to_delete.append(location_ref)

        event_dict = store.getEventDict(event_category="social")
        event_dict["locationRef"] = location_ref
        event = Event.from_dict(event_dict)
        event_ref = EventDao().create(event)
        self.refs_to_delete.append(event_ref)

        event_id = event_ref.id
        self.d = store.EventRideRequestFormDictFactory().create(
            event_id=event_id)
        self.ride_request_ids_to_delete = list()
示例#7
0
def close_event(event: Event):
    event.is_closed = True