Media build part 2 (unreleased): drive wiring in every app (R-1024/R-1037), old-install repair (R-1047), drive events notice + real restart now/later + stream check, file browser lets go of dead/removed drives and recreates on return (R-1038), safe removal keeps the drive (R-1044), Plex claim on the running server + probe accept (R-1028/R-1045)
gates / gates (push) Successful in 45s

Claude-Session: https://claude.ai/code/session_0159rPz1ZhFKsS53msqPYxtS
This commit is contained in:
2026-10-15 09:54:49 +02:00
parent 78c894234c
commit f580d88a14
46 changed files with 3700 additions and 8 deletions
@@ -0,0 +1,39 @@
package web
import (
"strings"
"testing"
"gitea.dooplex.hu/admin/felhom-controller/internal/stacks"
)
// R-1028: the Plex claim box renders only for a closed Plex gate — render test per branch (the seam-wiring rule).
// COMPANION RED-PROOF: remove the {{if .PlexClaim}} block → the first case fails. Restored.
func TestPlexClaimBox_RendersPerBranch(t *testing.T) {
st := lcStack("plex", "", true)
st.State = stacks.StateRunning
for _, c := range []struct {
name string
plexClaim bool
gateClosed bool
want bool
}{{"closed plex", true, true, true}, {"gate open", false, false, false}, {"other app closed", false, true, false}} {
d := appInfoData(st)
d["SetupGateClosed"] = c.gateClosed
d["PlexClaim"] = c.plexClaim
h := renderBackupPage(t, "app_info", d)
if got := strings.Contains(h, `data-plex-claim="true"`) && strings.Contains(h, `id="plex-claim-code"`); got != c.want {
t.Errorf("%s: claim box shown=%v, want %v", c.name, got, c.want)
}
}
}
// The code is checked for its shape before any call: no call for something that is not a claim code.
func TestPlexClaimCodeShape(t *testing.T) {
for code, ok := range map[string]bool{"claim-AbCdEf123456789_-xyz": true, "claim-short": false, "claim-abcdefgh": true, "claim-": false,
"https://plex.tv/claim": false, "claim-abc def": false, "": false} {
if got := plexClaimCode.MatchString(code); got != ok {
t.Errorf("%q: accepted=%v, want %v", code, got, ok)
}
}
}