def test_run_matches(self):
        '''
        Christine & Hilary - T
        Jameson & Anthony - T
        James & Joey - M
        Shimin & Tiffany - T
        Brooke & Chi - T
        Maddie & Alex F - M
        Austin & Nicole - M
        Rajiv & Lopa - W
        '''
        self.fresh_setup()
        christine = Profile.objects.get(first_name='christine')
        hilary = Profile.objects.get(first_name='hilary')
        jameson = Profile.objects.get(first_name='jameson')
        anthony = Profile.objects.get(first_name='anthony')
        james = Profile.objects.get(first_name='james')
        joey = Profile.objects.get(first_name='joey')
        shimin = Profile.objects.get(first_name='shimin')
        tiffany = Profile.objects.get(first_name='tiffany')
        brooke = Profile.objects.get(first_name='brooke')
        chi = Profile.objects.get(first_name='chi')
        maddie = Profile.objects.get(first_name='maddie')
        alex = Profile.objects.get(first_name='alex')
        austin = Profile.objects.get(first_name='austin')
        nicole = Profile.objects.get(first_name='nicole')
        rajiv = Profile.objects.get(first_name='rajiv')
        lopa = Profile.objects.get(first_name='lopa')

        christine_tue = Availability.objects.get(profile=christine,
                                                 time_available_utc=self.tue)
        jameson_tue = Availability.objects.get(profile=jameson,
                                               time_available_utc=self.tue)
        james_mon = Availability.objects.get(profile=james,
                                             time_available_utc=self.mon)
        shimin_tue = Availability.objects.get(profile=shimin,
                                              time_available_utc=self.tue)
        brooke_tue = Availability.objects.get(profile=brooke,
                                              time_available_utc=self.tue)
        maddie_mon = Availability.objects.get(profile=maddie,
                                              time_available_utc=self.mon)
        austin_mon = Availability.objects.get(profile=austin,
                                              time_available_utc=self.mon)
        rajiv_wed = Availability.objects.get(profile=rajiv,
                                             time_available_utc=self.wed)

        matches = [
            [christine_tue, christine, hilary],
            [jameson_tue, jameson, anthony],
            [james_mon, james, joey],
            [shimin_tue, shimin, tiffany],
            [brooke_tue, brooke, chi],
            [maddie_mon, maddie, alex],
            [austin_mon, austin, nicole],
            [rajiv_wed, rajiv, lopa],
        ]

        self.assertEqual(Command.run_one_on_one_matches(Command()), matches)
    def test_new_multiple_availabilities(self):
        '''
        Christine & Shimin - M
        '''
        self.fresh_setup()
        christine = Profile.objects.get(first_name='christine')
        shimin = Profile.objects.get(first_name='shimin')

        christine_mon = Availability.objects.get(profile=christine,
                                                 time_available_utc=self.mon)

        matches = [[christine_mon, christine, shimin]]

        self.assertEqual(Command.run_one_on_one_matches(Command()), matches)
    def test_add_new(self):
        '''
        Zara & James - T
        '''
        self.add_new()
        zara = Profile.objects.get(first_name='zara')
        james = Profile.objects.get(first_name='james')

        zara_tue = Availability.objects.get(profile=zara,
                                            time_available_utc=self.tue)

        matches = [[zara_tue, zara, james]]

        self.assertEqual(Command.run_one_on_one_matches(Command()), matches)
Esempio n. 4
0
    def test_match_and_run_fresh_first_day(self):
        self.fresh_setup()
        t = Profile.objects.get(first_name='tiffany')
        a = Profile.objects.get(first_name='andrew')
        pj = Profile.objects.get(first_name='philip')
        k = Profile.objects.get(first_name='karima')
        tim = Profile.objects.get(first_name='tim')
        mike = Profile.objects.get(first_name='michael')
        t_av_past = Availability.objects.get(profile=t,
                                             time_available_utc=self.past)
        a_av_future = Availability.objects.get(profile=a,
                                               time_available_utc=self.future)
        t_av_future = Availability.objects.get(profile=t,
                                               time_available_utc=self.future)
        k_av_future = Availability.objects.get(profile=k,
                                               time_available_utc=self.future)
        matches = [[a_av_future, a, pj], [t_av_future, t, tim],
                   [k_av_future, k, mike]]

        self.assertEqual(t_av_past.matched_name, None)
        self.assertEqual(Command.run_one_on_one_matches(Command()), matches)
Esempio n. 5
0
    def test_match_and_run_future_first_day(self):
        self.previous_matches_setup()
        t = Profile.objects.get(first_name='tiffany')
        a = Profile.objects.get(first_name='andrew')
        tim = Profile.objects.get(first_name='tim')
        mike = Profile.objects.get(first_name='michael')
        t_av_past = Availability.objects.get(profile=t,
                                             time_available_utc=self.past)
        a_av_past = Availability.objects.get(profile=a,
                                             time_available_utc=self.past)
        a_av_future = Availability.objects.get(profile=a,
                                               time_available_utc=self.future)
        t_av_future = Availability.objects.get(profile=t,
                                               time_available_utc=self.future)
        mike_av_past2 = Availability.objects.get(profile=mike,
                                                 time_available_utc=self.past2)

        self.assertEqual(t_av_past.matched_name, 'andrew test')
        self.assertEqual(a_av_past.matched_name, 'tiffany test')
        self.assertEqual(mike_av_past2.matched_name, None)

        matches = [[a_av_future, a, mike], [t_av_future, t, tim]]
        self.assertEqual(Command.run_one_on_one_matches(Command()), matches)
Esempio n. 6
0
 def test_match_and_run_future_second_day(self):
     self.future_matches_setup()
     self.assertEqual(Command.run_one_on_one_matches(Command()), [])