Example #1
0
 def test_game_run_heroku(self):
     x_size = 775
     y_size = 800
     game = Game("Checkers 100", x_size, y_size, "1.png", 120)
     game.objects = dict()
     game.player_c = 1
     game.computer_c = 1
     game.objects[(game.kx * 5, game.ky * 4)] = Player_checkers(game.kx * 5,
                                                                game.ky * 4,
                                                                game.kx,
                                                                (0, 0, 0))
     game.objects[(game.kx * 8, game.ky)] = Computer_checkers(game.kx * 8,
                                                              game.ky,
                                                              game.kx,
                                                              (255, 0, 0))
     game.handle_mouse_down((game.kx * 5, game.ky * 4))
     game.handle_events = MagicMock(
         return_value=game.handle_mouse_down((game.kx * 5, game.ky * 2)))
     conf = dict()
     conf['0'] = str(775 - game.kx * 8) + '-' + str(
         800 - game.ky) + '-' + str(
         775 - game.kx * 2) + '-' + str(800 - game.ky * 3) + '-0'
     game.get_config = MagicMock(return_value=conf)
     game.run_heroku()
     self.assertTrue(True)
Example #2
0
 def test_game_run_computer(self):
     x_size = 775
     y_size = 800
     game = Game("Checkers 100", x_size, y_size, "1.png", 120)
     game.objects = dict()
     game.player_c = 1
     game.computer_c = 1
     game.objects[(game.kx * 5, game.ky * 2)] = Computer_checkers(
         game.kx * 5, game.ky * 2, game.kx, (255, 0, 0))
     game.objects[(game.kx * 5, game.ky * 4)] = Player_checkers(game.kx * 5,
                                                                game.ky * 4,
                                                                game.kx,
                                                                (0, 0, 0))
     game.turn = "Computer"
     game.run_computer()
     self.assertTrue(True)