feat: Add delete and preview functionality for branding in settings dialog and update translations

This commit is contained in:
claudi 2026-04-15 15:15:56 +02:00
parent e1dbc2ee84
commit b826bd9b20
10 changed files with 143 additions and 17 deletions

View file

@ -1,6 +1,8 @@
"""Tests for runtime branding template management."""
from webdrop_bridge.config import Config
import pytest
from webdrop_bridge.config import Config, ConfigurationError
from webdrop_bridge.core.branding_manager import BrandingManager
@ -97,3 +99,28 @@ def test_switching_back_to_default_restores_default_branding(tmp_path):
assert config.app_name == "WebDrop Bridge"
assert config.branding_display_name == "Default"
def test_delete_custom_branding_removes_it(tmp_path):
"""Custom brandings should be removable while built-ins stay protected."""
manager = BrandingManager(base_dir=tmp_path)
template = manager.build_template(template_id="Customer B", display_name="Customer B")
manager.save_template(template)
assert manager.has_template("customer_b")
manager.delete_template("customer_b")
assert not manager.has_template("customer_b")
def test_invalid_logo_file_is_rejected(tmp_path):
"""Non-existent logo files should not be accepted for saved brandings."""
manager = BrandingManager(base_dir=tmp_path)
with pytest.raises(ConfigurationError):
manager.build_template(
template_id="customer_c",
display_name="Customer C",
logo_path=str(tmp_path / "missing-logo.png"),
)