Publish current app and server

This commit is contained in:
ponzischeme89
2026-08-02 22:10:19 +12:00
parent a265636139
commit 1ed180c739
203 changed files with 23933 additions and 2788 deletions
+52 -15
View File
@@ -1,20 +1,9 @@
package config
import "testing"
func TestDefaultClientAllowanceIsOne(t *testing.T) {
t.Setenv("MEMBY_EMBY_URL", "http://emby")
t.Setenv("MEMBY_DATABASE_URL", "postgres://memby")
t.Setenv("MEMBY_MAX_CLIENTS_PER_USER", "")
cfg, err := Load()
if err != nil {
t.Fatalf("Load: %v", err)
}
if cfg.MaxClientsPerUser != 1 {
t.Fatalf("MaxClientsPerUser = %d, want 1", cfg.MaxClientsPerUser)
}
}
import (
"testing"
"time"
)
func TestTracearrURLAndKeyMustBeConfiguredTogether(t *testing.T) {
t.Setenv("MEMBY_EMBY_URL", "http://emby")
@@ -26,3 +15,51 @@ func TestTracearrURLAndKeyMustBeConfiguredTogether(t *testing.T) {
t.Fatal("expected incomplete Tracearr configuration to fail")
}
}
func TestRadarrURLAndKeyMustBeConfiguredTogether(t *testing.T) {
t.Setenv("MEMBY_EMBY_URL", "http://emby")
t.Setenv("MEMBY_DATABASE_URL", "postgres://memby")
t.Setenv("MEMBY_RADARR_URL", "http://radarr")
t.Setenv("MEMBY_RADARR_API_KEY", "")
if _, err := Load(); err == nil {
t.Fatal("expected incomplete Radarr configuration to fail")
}
}
func TestForYouDefaultsToDailyOffPeakRebuild(t *testing.T) {
t.Setenv("MEMBY_EMBY_URL", "http://emby")
t.Setenv("MEMBY_DATABASE_URL", "postgres://memby")
t.Setenv("MEMBY_FOR_YOU_MIN_REBUILD_AGE", "")
t.Setenv("MEMBY_FOR_YOU_REFRESH_INTERVAL", "")
t.Setenv("MEMBY_FOR_YOU_REBUILD_HOUR", "")
cfg, err := Load()
if err != nil {
t.Fatal(err)
}
if cfg.ForYouMinRebuildAge != 24*time.Hour ||
cfg.ForYouRefreshInterval != 24*time.Hour ||
cfg.ForYouRebuildHour != 4 {
t.Fatalf("For You schedule = %v/%v hour %d",
cfg.ForYouMinRebuildAge, cfg.ForYouRefreshInterval, cfg.ForYouRebuildHour)
}
}
func TestForYouRebuildHourIsValidated(t *testing.T) {
t.Setenv("MEMBY_EMBY_URL", "http://emby")
t.Setenv("MEMBY_DATABASE_URL", "postgres://memby")
t.Setenv("MEMBY_FOR_YOU_REBUILD_HOUR", "24")
if _, err := Load(); err == nil {
t.Fatal("expected invalid rebuild hour to fail")
}
}
func TestRecommendationWeightsMustBeJSON(t *testing.T) {
t.Setenv("MEMBY_EMBY_URL", "http://emby")
t.Setenv("MEMBY_DATABASE_URL", "postgres://memby")
t.Setenv("MEMBY_RECOMMENDATION_WEIGHTS", "{broken")
if _, err := Load(); err == nil {
t.Fatal("expected invalid recommendation weights to fail")
}
}