mirror of
https://github.com/wizarrrr/wizarr.git
synced 2026-07-30 23:07:19 -04:00
* fix: resolve button widget context URLs Fixes #1280 * fix: return relative invitation API URLs Fixes #1262 * fix: use modern Jellyfin auth headers Fixes #1309 * fix: use Emby library GUIDs for access policy Fixes #1303
36 lines
1.1 KiB
Python
36 lines
1.1 KiB
Python
from app.services.wizard_widgets import ButtonWidget, process_widget_placeholders
|
|
|
|
|
|
def test_button_widget_resolves_context_variable_url():
|
|
html = ButtonWidget().render(
|
|
"jellyfin",
|
|
_context={"external_url": "https://jellyfin.example.com"},
|
|
url="external_url",
|
|
text="Open Jellyfin",
|
|
)
|
|
|
|
assert 'href="https://jellyfin.example.com"' in html
|
|
assert "Open Jellyfin" in html
|
|
|
|
|
|
def test_button_widget_accepts_legacy_context_keyword():
|
|
html = ButtonWidget().render(
|
|
"jellyfin",
|
|
context={"external_url": "https://jellyfin.example.com"},
|
|
url="external_url",
|
|
text="Open Jellyfin",
|
|
)
|
|
|
|
assert 'href="https://jellyfin.example.com"' in html
|
|
|
|
|
|
def test_process_widget_placeholders_passes_context_to_button_widget():
|
|
html = process_widget_placeholders(
|
|
'{{ widget:button url="external_url" text="Open Jellyfin" }}',
|
|
"jellyfin",
|
|
context={"external_url": "https://jellyfin.example.com"},
|
|
)
|
|
|
|
assert 'href="https://jellyfin.example.com"' in html
|
|
assert "Open Jellyfin" in html
|