Files
olons_server/internal/config/config_test.go
T

22 lines
534 B
Go

package config
import "testing"
func TestDefaultConfigUsesOlonsAdmin(t *testing.T) {
cfg := defaultConfig()
if err := cfg.validate(); err != nil {
t.Fatal(err)
}
if cfg.Auth.DefaultTenantID != 0 {
t.Fatalf("DefaultTenantID = %d", cfg.Auth.DefaultTenantID)
}
}
func TestConfigRejectsOtherDatabase(t *testing.T) {
cfg := defaultConfig()
cfg.MySQL.DSN = "root:root@tcp(127.0.0.1:3306)/other_database?parseTime=true"
if err := cfg.validate(); err == nil {
t.Fatal("expected non-olons_admin database to be rejected")
}
}