Esempio n. 1
0
    def test_no_signups(self):
        """Trips are made FCFS, even if nobody signed up."""
        runner = run.WinterSchoolLotteryRunner()
        runner()

        for trip in [self.hike, self.ice]:
            trip.refresh_from_db()
            self._assert_fcfs_at_noon(trip)
Esempio n. 2
0
    def test_non_ws_trips_ignored(self):
        """ Participants with signups for non-WS trips are handled.

        Namely,
        - a participant's signup for a non-WS trip does not affect the lottery
        - The cleanup phase of the lottery does not modify any non-WS trips
        """
        outside_iap_trip = factories.TripFactory.create(
            name='non-WS trip',
            algorithm='lottery',
            program=enums.Program.WINTER_NON_IAP.value,
            trip_date=date(2020, 1, 18),
        )
        office_day = factories.TripFactory.create(
            name='Office Day',
            algorithm='fcfs',
            program=enums.Program.NONE.value,
            trip_date=date(2020, 1, 19),
        )

        # Sign up the hiker for all three trips!
        for trip in [self.hike, outside_iap_trip, office_day]:
            factories.SignUpFactory.create(participant=self.hiker, trip=trip)

        runner = run.WinterSchoolLotteryRunner()
        runner()

        # The participant was placed on their desired WS trip!
        ws_signup = models.SignUp.objects.get(trip=self.hike,
                                              participant=self.hiker)
        self.assertTrue(ws_signup.on_trip)

        # Neither of the other two trips had their algorithm or start time adjusted
        outside_iap_trip.refresh_from_db()
        self.assertEqual(outside_iap_trip.algorithm, 'lottery')
        office_day.refresh_from_db()
        self.assertEqual(office_day.signups_open_at, date_utils.local_now())
Esempio n. 3
0
 def setUp(self):
     self.trip = factories.TripFactory.create(
         algorithm='lottery', program=enums.Program.WINTER_SCHOOL.value)
     self.runner = run.WinterSchoolLotteryRunner()