def test_game_next_question_no_more_images(self, mocker): mock_prepare_picture_round = mocker.patch( "qwazzock.Game.prepare_picture_round") game = Game() game.question_type = "picture" game.selected_image_index = 2 game.question_images = ["foo.jpg", "bar.png", "blah.bmp"] game.next_question() assert game.question_type == "standard" assert len(mock_prepare_picture_round.mock_calls) == 2
def test_game_next_question_ok(self, mocker): mocker.patch("qwazzock.Game.prepare_picture_round") game = Game() game.question_type = "picture" game.selected_image_index = 1 game.question_images = ["foo.jpg", "bar.png", "blah.bmp"] game.next_question() assert game.selected_image_index == 2 assert game.selected_image == "blah.bmp" assert game.question_type == "picture"
def test_host_client_socket_picture_event_no_images(socketio_test_client, mocker): mock_socketio_emit = mocker.patch("qwazzock.server.SocketIO.emit") game = Game() game.question_type = "foo" game.selected_image_index = None socketio_test_client_under_test = socketio_test_client(game) socketio_test_client_under_test.connect(namespace="/host_client_socket") socketio_test_client_under_test.emit( namespace="/host_client_socket", event="picture" ) assert game.question_type == "foo"