Exemple #1
0
    def test_gameplayer_update_notification_E(self):
        """ 
          When a Gameplayer another_chance is updated we create a Notification

          Owner invites Gameplayer again after he had asked for another chance to play
        """

        # Player invited
        gp = GamePlayerFactory()
        self.assertEqual(NotificationGame.objects.count(), 1)
        self.assertEqual(NotificationGame.objects.filter(player = gp.player).count(), 1)

        # Player rejects 
        gp.status = False
        gp.save()
        self.assertEqual(NotificationGame.objects.filter(player = gp.player).count(), 1)
        self.assertEqual(NotificationGame.objects.count(), 2)

        # Player asks for another chance
        gp.another_chance = True
        gp.save()
        self.assertEqual(NotificationGame.objects.filter(player = gp.player).count(), 1)
        self.assertEqual(NotificationGame.objects.count(), 3)

        # Player invites again the user
        gp.reset()
        gp.save()
        self.assertEqual(NotificationGame.objects.filter(player = gp.player).count(), 2)
        self.assertEqual(NotificationGame.objects.filter(player = gp.player, active = True).count(), 1)
        self.assertEqual(NotificationGame.objects.count(), 4)
Exemple #2
0
    def test_gameplayer_update_notification_E(self):
        """ 
          When a Gameplayer another_chance is updated we create a Notification

          Owner invites Gameplayer again after he had asked for another chance to play
        """

        # Player invited
        gp = GamePlayerFactory()
        self.assertEqual(NotificationGame.objects.count(), 1)
        self.assertEqual(
            NotificationGame.objects.filter(player=gp.player).count(), 1)

        # Player rejects
        gp.status = False
        gp.save()
        self.assertEqual(
            NotificationGame.objects.filter(player=gp.player).count(), 1)
        self.assertEqual(NotificationGame.objects.count(), 2)

        # Player asks for another chance
        gp.another_chance = True
        gp.save()
        self.assertEqual(
            NotificationGame.objects.filter(player=gp.player).count(), 1)
        self.assertEqual(NotificationGame.objects.count(), 3)

        # Player invites again the user
        gp.reset()
        gp.save()
        self.assertEqual(
            NotificationGame.objects.filter(player=gp.player).count(), 2)
        self.assertEqual(
            NotificationGame.objects.filter(player=gp.player,
                                            active=True).count(), 1)
        self.assertEqual(NotificationGame.objects.count(), 4)