fix: Ensure release objects are not None in update flow integration tests
This commit is contained in:
parent
e1bf5a57c2
commit
ca9526c1c1
2 changed files with 13 additions and 8 deletions
|
|
@ -5,7 +5,7 @@ import logging
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
|
|
||||||
from PySide6.QtCore import QSize, Qt, QThread, QUrl, Signal
|
from PySide6.QtCore import QObject, QSize, Qt, QThread, QUrl, Signal
|
||||||
from PySide6.QtWidgets import QLabel, QMainWindow, QStatusBar, QToolBar, QVBoxLayout, QWidget
|
from PySide6.QtWidgets import QLabel, QMainWindow, QStatusBar, QToolBar, QVBoxLayout, QWidget
|
||||||
|
|
||||||
from webdrop_bridge.config import Config
|
from webdrop_bridge.config import Config
|
||||||
|
|
@ -657,9 +657,14 @@ class MainWindow(QMainWindow):
|
||||||
logger.error("Failed to launch update installer")
|
logger.error("Failed to launch update installer")
|
||||||
|
|
||||||
|
|
||||||
class UpdateCheckWorker:
|
class UpdateCheckWorker(QObject):
|
||||||
"""Worker for running update check asynchronously."""
|
"""Worker for running update check asynchronously."""
|
||||||
|
|
||||||
|
# Define signals at class level
|
||||||
|
update_available = Signal(object) # Emits Release object
|
||||||
|
update_status = Signal(str, str) # Emits (status_text, emoji)
|
||||||
|
finished = Signal()
|
||||||
|
|
||||||
def __init__(self, manager, current_version: str):
|
def __init__(self, manager, current_version: str):
|
||||||
"""Initialize worker.
|
"""Initialize worker.
|
||||||
|
|
||||||
|
|
@ -667,15 +672,10 @@ class UpdateCheckWorker:
|
||||||
manager: UpdateManager instance
|
manager: UpdateManager instance
|
||||||
current_version: Current app version
|
current_version: Current app version
|
||||||
"""
|
"""
|
||||||
|
super().__init__()
|
||||||
self.manager = manager
|
self.manager = manager
|
||||||
self.current_version = current_version
|
self.current_version = current_version
|
||||||
|
|
||||||
# Create signals
|
|
||||||
from PySide6.QtCore import Signal
|
|
||||||
self.update_available = Signal(object)
|
|
||||||
self.update_status = Signal(str, str)
|
|
||||||
self.finished = Signal()
|
|
||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
"""Run the update check."""
|
"""Run the update check."""
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,8 @@ class TestUpdateFlowIntegration:
|
||||||
assert mock_fetch.call_count == 1 # Still 1, cache used
|
assert mock_fetch.call_count == 1 # Still 1, cache used
|
||||||
|
|
||||||
# Verify both got same result
|
# Verify both got same result
|
||||||
|
assert release1 is not None
|
||||||
|
assert release2 is not None
|
||||||
assert release1.version == release2.version
|
assert release1.version == release2.version
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
|
@ -164,6 +166,7 @@ class TestUpdateFlowIntegration:
|
||||||
release = await manager.check_for_updates()
|
release = await manager.check_for_updates()
|
||||||
|
|
||||||
# Version should be extracted correctly (without 'v')
|
# Version should be extracted correctly (without 'v')
|
||||||
|
assert release is not None
|
||||||
assert release.version == "1.2.3"
|
assert release.version == "1.2.3"
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
@pytest.mark.asyncio
|
||||||
|
|
@ -180,6 +183,7 @@ class TestUpdateFlowIntegration:
|
||||||
release = await manager.check_for_updates()
|
release = await manager.check_for_updates()
|
||||||
|
|
||||||
# Should have both exe and checksum
|
# Should have both exe and checksum
|
||||||
|
assert release is not None
|
||||||
assert len(release.assets) == 2
|
assert len(release.assets) == 2
|
||||||
asset_names = [a["name"] for a in release.assets]
|
asset_names = [a["name"] for a in release.assets]
|
||||||
assert "WebDropBridge.exe" in asset_names
|
assert "WebDropBridge.exe" in asset_names
|
||||||
|
|
@ -199,5 +203,6 @@ class TestUpdateFlowIntegration:
|
||||||
release = await manager.check_for_updates()
|
release = await manager.check_for_updates()
|
||||||
|
|
||||||
# Changelog should be available
|
# Changelog should be available
|
||||||
|
assert release is not None
|
||||||
assert release.body == mock_forgejo_response["body"]
|
assert release.body == mock_forgejo_response["body"]
|
||||||
assert "Bug Fixes" in release.body
|
assert "Bug Fixes" in release.body
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue