def get_game(self): year = int(self.kwargs.get('year', 0)) month = int(self.kwargs.get('month', 0)) if not year: game = Game.active() else: date = datetime.datetime(year=year, month=month, day=15) game = Game.active(now=date) if game is None: game = Game.objects.latest() return game
def test_not_active(self): self.make_game(start=self.tomorrow, end=self.late) active = Game.active() self.assertEqual(active, None)
def test_active(self): game = self.make_game() active = Game.active() self.assertEqual(active, game)