def test_no_puedo_agregar_el_mismo_jugador_a_dos_lobbies(self) -> None: mind = MindControl() mind.agregar_lobby('Kanto') mind.agregar_lobby('Johto') mind.agregar_jugador('Articuno', 'Kanto') self.assertRaises(JugadorExistenteException, mind.agregar_jugador, 'Articuno', 'Johto')
from model.juego import Juego from model.lobby import Lobby from model.mind_control import MindControl app = Flask("__main__") socketio = SocketIO(app, engineio_logger=True, cors_allowed_origins=[ 'http://*****:*****@app.route("/") def my_index(): return "Mejor proba con localhost:3000" @app.route("/time") def time_api(): return {'time': time.time()}
def test_no_puedo_iniciar_juego_en_lobby_inexistente(self) -> None: mind = MindControl() self.assertRaises(LobbyInexistenteException, mind.iniciar_juego_en, 'Kanto')
def test_estado_de_lobby_inexistente_da_error(self) -> None: mind = MindControl() self.assertRaises(LobbyInexistenteException, mind.estado_lobby, 'Kanto')
def test_agregar_jugador_a_lobby_inexistente_lo_crea(self) -> None: mind = MindControl() mind.agregar_jugador('Articuno', 'Kanto') self.assertEqual({'jugadores': ['Articuno']}, mind.estado_lobby('Kanto'))
def test_no_puedo_desconectar_un_jugador_inexistente(self) -> None: mind = MindControl() self.assertRaises(JugadorInexistenteException, mind.desconectar_jugador, 'Articuno')
def mind_juego_iniciado() -> MindControl: mind = MindControl() mind.agregar_jugador('Articuno', 'Kanto') mind.agregar_jugador('Zapdos', 'Kanto') mind.iniciar_juego_en('Kanto') return mind
def mind_con_un_jugador() -> MindControl: mind = MindControl() mind.agregar_jugador('Articuno', 'Kanto') return mind
def test_no_puedo_agregar_lobby_existente(self) -> None: mind = MindControl() mind.agregar_lobby('Kanto') self.assertRaises(LobbyExistenteException, mind.agregar_lobby, 'Kanto')
def test_no_puedo_crear_jugador_nombre_largo(self) -> None: mind = MindControl() self.assertRaises(InvalidNameException, mind.agregar_jugador, 'EsteEsUnNombreMuyLargo', 'Kanto')
def test_puedo_agregar_lobby_nuevo(self) -> None: mind = MindControl() mind.agregar_lobby('Kanto') self.assertEqual({'jugadores': []}, mind.estado_lobby('Kanto'))