ocr is working
This commit is contained in:
@@ -9,7 +9,7 @@ func clearEnv(t *testing.T) {
|
||||
t.Helper()
|
||||
for _, name := range []string{
|
||||
"PORT", "DATABASE_URL", "UPLOAD_DIR", "MAX_FILE_SIZE_MB",
|
||||
"OCR_LANG", "AUTH_SECRET", "ADMIN_USERNAME", "ADMIN_PASSWORD",
|
||||
"OCR_LANG", "OCR_WORKERS", "AUTH_SECRET", "ADMIN_USERNAME", "ADMIN_PASSWORD",
|
||||
} {
|
||||
t.Setenv(name, "")
|
||||
}
|
||||
@@ -37,6 +37,9 @@ func TestLoadApplicationDefaults(t *testing.T) {
|
||||
if cfg.OcrLang != "fra+eng" {
|
||||
t.Errorf("OcrLang défaut inattendu: %q", cfg.OcrLang)
|
||||
}
|
||||
if cfg.OcrWorkers != 2 {
|
||||
t.Errorf("OcrWorkers = %d, attendu 2", cfg.OcrWorkers)
|
||||
}
|
||||
if cfg.AuthSecret != "dev-secret-change-me" {
|
||||
t.Errorf("AuthSecret défaut inattendu: %q", cfg.AuthSecret)
|
||||
}
|
||||
@@ -52,6 +55,7 @@ func TestLoadApplicationEnvOverrides(t *testing.T) {
|
||||
t.Setenv("DATABASE_URL", "postgres://u:p@host:5433/db?sslmode=disable")
|
||||
t.Setenv("UPLOAD_DIR", "/tmp/up")
|
||||
t.Setenv("OCR_LANG", "eng")
|
||||
t.Setenv("OCR_WORKERS", "4")
|
||||
t.Setenv("AUTH_SECRET", "super-secret")
|
||||
t.Setenv("ADMIN_USERNAME", "root")
|
||||
t.Setenv("ADMIN_PASSWORD", "toor")
|
||||
@@ -61,7 +65,7 @@ func TestLoadApplicationEnvOverrides(t *testing.T) {
|
||||
t.Fatalf("LoadApplicationConfig: %v", err)
|
||||
}
|
||||
if cfg.Port != 9090 || cfg.MaxFileSizeMB != 120 || cfg.DatabaseURL != "postgres://u:p@host:5433/db?sslmode=disable" ||
|
||||
cfg.UploadDir != "/tmp/up" || cfg.OcrLang != "eng" || cfg.AuthSecret != "super-secret" ||
|
||||
cfg.UploadDir != "/tmp/up" || cfg.OcrLang != "eng" || cfg.OcrWorkers != 4 || cfg.AuthSecret != "super-secret" ||
|
||||
cfg.AdminUsername != "root" || cfg.AdminPassword != "toor" {
|
||||
t.Errorf("overrides non appliqués: %+v", cfg)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user