feat(05-02): printer detail page with export buttons and command preview
- Update printer_detail() to pass install_cmd, uninstall_cmd, has_driver, has_icon to template - Rewrite printer_detail.html with Intune Commands, Export, and Icon sections - Show command strings with Alpine.js copy-to-clipboard buttons (install-cmd, uninstall-cmd) - Show NinjaRMM ZIP and .intunewin download links when driver assigned - Add HTMX icon upload form with #icon-status swap target - Remove disabled placeholder Regenerate Package button - Add TestCommandPreview class (4 tests) to test_packages.py - All 94 tests pass
This commit is contained in:
@@ -144,3 +144,48 @@ class TestIntunewinDownload:
|
||||
def test_422_no_driver(self, client, printer_no_driver):
|
||||
resp = client.get(f"/printers/{printer_no_driver.id}/packages/intunewin")
|
||||
assert resp.status_code == 422
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Printer detail page — command preview and export links
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
class TestCommandPreview:
|
||||
def test_detail_page_shows_commands(self, client, setup_printer_with_driver):
|
||||
"""Printer detail page shows install and uninstall command strings."""
|
||||
printer, _ = setup_printer_with_driver
|
||||
resp = client.get(f"/printers/{printer.id}")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
assert "install-cmd" in html
|
||||
assert "uninstall-cmd" in html
|
||||
assert "install.ps1" in html
|
||||
assert "uninstall.ps1" in html
|
||||
|
||||
def test_detail_page_shows_export_links(self, client, setup_printer_with_driver):
|
||||
"""Printer detail page shows NinjaRMM ZIP and .intunewin download links."""
|
||||
printer, _ = setup_printer_with_driver
|
||||
resp = client.get(f"/printers/{printer.id}")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
assert f"/printers/{printer.id}/packages/ninja" in html
|
||||
assert f"/printers/{printer.id}/packages/intunewin" in html
|
||||
|
||||
def test_detail_page_hides_commands_without_driver(self, client, printer_no_driver):
|
||||
"""Detail page hides command section and export links when no driver assigned."""
|
||||
resp = client.get(f"/printers/{printer_no_driver.id}")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
assert "install-cmd" not in html
|
||||
assert "packages/ninja" not in html
|
||||
assert "packages/intunewin" not in html
|
||||
|
||||
def test_detail_page_shows_icon_upload_form(self, client, setup_printer_with_driver):
|
||||
"""Printer detail page always shows icon upload form."""
|
||||
printer, _ = setup_printer_with_driver
|
||||
resp = client.get(f"/printers/{printer.id}")
|
||||
assert resp.status_code == 200
|
||||
html = resp.text
|
||||
assert f"/printers/{printer.id}/icon" in html
|
||||
assert "icon-status" in html
|
||||
|
||||
Reference in New Issue
Block a user