Null-DRM-Official/apps/modules/bbc/bbc_test.go
404errordeveloper da8e1123ec
All checks were successful
release / build-and-upload (push) Successful in 7m5s
Streamd v0.2.0: rename, modules panel, stable/beta channels
- Rename product/host binary to streamd (drm compat copy still shipped)
- Go module path streamd; STREAMD_* env aliases; agent UA streamd-agent
- Panel Modules store + agent pull sync (modstore / modsync)
- Rolling stable + beta download tags; README/docs channel curl blocks
- Release notes in docs/releases/v0.2.0.md attached by Forgejo Actions
2026-10-10 15:58:26 +02:00

80 lines
2 KiB
Go

package bbc
import (
"testing"
appreg "streamd/app"
"streamd/capture"
"streamd/modcfg"
"streamd/modules/provider"
"streamd/mpd"
)
var (
_ appreg.App = (*App)(nil)
_ appreg.StreamDefaults = (*App)(nil)
_ appreg.TransparentMITM = (*App)(nil)
)
func testApp(t *testing.T) *App {
t.Helper()
cfg := Config{
Channels: map[string]Channel{
"bbcone": {Label: "BBC One", VPID: "bbc_one_london"},
"bbctwo": {Label: "BBC Two", VPID: "bbc_two_england"},
},
Common: provider.Common{
Package: "bbc.iplayer.android",
Aliases: map[string]string{"one": "bbcone", "bbc1": "bbcone"},
Score: capture.ScoreCfg{
Hosts: []string{"open.live.bbc.co.uk", "vs-cmaf-push-uk"},
},
},
}.withDefaults()
labels := map[string]string{}
for id, ch := range cfg.Channels {
labels[id] = ch.Label
}
return &App{Base: provider.New(Name, cfg.Common, labels, modcfg.Result{Path: "test"}), cfg: cfg}
}
func TestNoHardcodedSecrets(t *testing.T) {
cfg := Config{}.withDefaults()
if cfg.Package != "" || cfg.LicenseURL != "" {
t.Fatalf("empty config must not invent package/license: %+v", cfg)
}
}
func TestKeyModeNoneAndMPDOnly(t *testing.T) {
a := testApp(t)
if a.KeyMode() != "none" {
t.Fatalf("KeyMode = %q, want none", a.KeyMode())
}
h := a.CaptureHints()
if len(h.Require) != 1 || h.Require[0] != "mpd" {
t.Fatalf("Require = %v, want [mpd]", h.Require)
}
if !a.UseTransparentMITM() {
t.Fatal("BBC must use transparent MITM (UK VPN)")
}
if _, ok := a.MPDRewriter().(mpd.Passthrough); !ok {
t.Fatal("expected Passthrough rewriter")
}
}
func TestAliases(t *testing.T) {
a := testApp(t)
id, err := a.Resolve("one")
if err != nil || id != "bbcone" {
t.Fatalf("Resolve(one) = %q %v", id, err)
}
}
func TestCaptureHintsScoreHosts(t *testing.T) {
a := testApp(t)
h := a.CaptureHints()
u := "https://vs-cmaf-push-uk.live.fastly.md.bbci.co.uk/x/mobile.mpd"
if h.Score.Score(u) <= 0 {
t.Fatalf("expected positive score for %s (score=%d)", u, h.Score.Score(u))
}
}