Exemplo n.º 1
0
 def test_play_game_move(self, mock_stdout, mock_input, mock_game_event):
     character.set_coordinates(20, 20)
     try:
         play_game()
     except SystemExit:
         pass
     self.assertEqual((20, 19), character.get_coordinates())
Exemplo n.º 2
0
 def test_play_game_print_introduction(self, mock_stdout, mock_input):
     try:
         play_game()
     except SystemExit:
         pass
     self.assertTrue("VALID COMMANDS: n, w, s, e, quit, restart." in
                     mock_stdout.getvalue())
Exemplo n.º 3
0
 def test_play_game_game_event(self, mock_stdout, mock_input, mock_random):
     character.set_hp(9)
     character.set_coordinates(20, 20)
     try:
         play_game()
     except SystemExit:
         pass
     self.assertEqual(10, character.get_hp())
Exemplo n.º 4
0
 def test_play_game_print_map(self, mock_stdout, mock_input):
     try:
         play_game()
     except SystemExit:
         pass
     self.assertTrue(
         "| - - - - - - - - - - - - - - - - - - - - - - - - - - - "
         "- - - - - - - - - - - - - - - |" in mock_stdout.getvalue())
Exemplo n.º 5
0
 def test_play_game_restart_game(self, mock_stdout, mock_input):
     try:
         play_game()
     except SystemExit:
         pass
     self.assertTrue("RESTART GAME" in mock_stdout.getvalue())
Exemplo n.º 6
0
 def test_play_game_quit_game(self, mock_stdout, mock_input):
     try:
         play_game()
     except SystemExit:
         pass
     self.assertTrue("GAME SAVED" in mock_stdout.getvalue())