Big changes
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
func TestTracearrURLAndKeyMustBeConfiguredTogether(t *testing.T) {
|
||||
t.Setenv("MEMBY_EMBY_URL", "http://emby")
|
||||
t.Setenv("MEMBY_DATABASE_URL", "postgres://memby")
|
||||
t.Setenv("MEMBY_TRACEARR_URL", "http://tracearr")
|
||||
t.Setenv("MEMBY_TRACEARR_API_KEY", "")
|
||||
|
||||
if _, err := Load(); err == nil {
|
||||
t.Fatal("expected incomplete Tracearr configuration to fail")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user