Example #1
0
async def test_auto_update(skip_qtbot, qapp):
    # Setup
    update_mock = AsyncMock()
    backend = MagicMock()

    game_connection = GameConnection(backend)
    game_connection._notify_status = MagicMock()
    game_connection.update = update_mock

    # Run
    await game_connection._auto_update()

    # Assert
    update_mock.assert_awaited_once_with(game_connection._dt)
    game_connection._notify_status.assert_called_once_with()
async def test_update(skip_qtbot, qapp):
    # Setup
    backend_update = AsyncMock()

    backend = MagicMock()
    backend.update = backend_update

    game_connection = GameConnection(backend)
    game_connection._notify_status = MagicMock()

    # Run
    await game_connection._update()

    # Assert
    backend_update.assert_awaited_once_with(game_connection._dt)
    game_connection._notify_status.assert_called_once_with()