Esempio n. 1
0
    def test_missions(self):
        """Tets the missions()."""
        on_clock = MissionClockEvent(user=self.user1,
                                     team_on_clock=True,
                                     team_on_timeout=False)
        on_clock.save()
        on_clock.timestamp = self.year2000
        on_clock.save()

        on_timeout = MissionClockEvent(user=self.user1,
                                       team_on_clock=False,
                                       team_on_timeout=True)
        on_timeout.save()
        on_timeout.timestamp = self.year2001
        on_timeout.save()

        off_timeout = MissionClockEvent(user=self.user1,
                                        team_on_clock=True,
                                        team_on_timeout=False)
        off_timeout.save()
        off_timeout.timestamp = self.year2002
        off_timeout.save()

        off_clock = MissionClockEvent(user=self.user1,
                                      team_on_clock=False,
                                      team_on_timeout=False)
        off_clock.save()
        off_clock.timestamp = self.year2003
        off_clock.save()

        random_event = MissionClockEvent(user=self.user2,
                                         team_on_clock=True,
                                         team_on_timeout=False)
        random_event.save()

        missions = MissionClockEvent.missions(self.user1)
        self.assertEqual([
            TimePeriod(self.year2000, self.year2001),
            TimePeriod(self.year2002, self.year2003)
        ], missions)
Esempio n. 2
0
    def test_missions(self):
        """Tets the missions()."""
        on_clock = MissionClockEvent(user=self.user1,
                                     team_on_clock=True,
                                     team_on_timeout=False)
        on_clock.save()
        on_clock.timestamp = self.year2000
        on_clock.save()

        on_timeout = MissionClockEvent(user=self.user1,
                                       team_on_clock=False,
                                       team_on_timeout=True)
        on_timeout.save()
        on_timeout.timestamp = self.year2001
        on_timeout.save()

        off_timeout = MissionClockEvent(user=self.user1,
                                        team_on_clock=True,
                                        team_on_timeout=False)
        off_timeout.save()
        off_timeout.timestamp = self.year2002
        off_timeout.save()

        off_clock = MissionClockEvent(user=self.user1,
                                      team_on_clock=False,
                                      team_on_timeout=False)
        off_clock.save()
        off_clock.timestamp = self.year2003
        off_clock.save()

        random_event = MissionClockEvent(user=self.user2,
                                         team_on_clock=True,
                                         team_on_timeout=False)
        random_event.save()

        missions = MissionClockEvent.missions(self.user1)
        self.assertEqual(
            [TimePeriod(self.year2000, self.year2001),
             TimePeriod(self.year2002, self.year2003)], missions)