def test_update_moves_to_next_after_playetime_elapsed(self):
# Setup, add two players and make the first active.
laser_players = players.Players(1)
laser_players.add_player('192.168.0.1')
laser_players.add_player('192.168.0.2')
start_active = unittest.mock.Mock()
end_active = unittest.mock.Mock()
laser_players.update(1, start_active, end_active)
start_active.reset_mock()
end_active.reset_mock()
# Update with two seconds of time so the first player time is up, then
# check next player is active.
laser_players.update(2, start_active, end_active)
end_active.assert_called_once_with('192.168.0.1')
start_active.assert_called_once_with('192.168.0.2')
self.assertEqual(('192.168.0.2', 1), laser_players.active_player())
评论列表
文章目录