示例#1
0
    def test_sync_methods(self):
        player = self._get_player()
        coin = Coin.add('points')

        History.objects.create(user=player.user, coin=coin, amount=10)
        self.assertEqual(player.points, 0)
        scoring.sync_user(player)
        self.assertEqual(player.points, 10)

        History.objects.create(user=player.user, coin=coin, amount=10)
        self.assertEqual(player.points, 10)
        scoring.sync_all_user_points()
        player = Player.objects.get(pk=player.pk)
        self.assertEqual(player.points, 20)
示例#2
0
文件: tests.py 项目: PopAdi/wouso
    def test_sync_methods(self):
        player = self._get_player()
        coin = Coin.add('points')

        History.objects.create(user=player.user, coin=coin, amount=10)
        self.assertEqual(player.points, 0)
        scoring.sync_user(player)
        self.assertEqual(player.points, 10)

        History.objects.create(user=player.user, coin=coin, amount=10)
        self.assertEqual(player.points, 10)
        scoring.sync_all_user_points()
        player = Player.objects.get(pk=player.pk)
        self.assertEqual(player.points, 20)