mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-08-02 00:48:55 +02:00
32 lines
920 B
Go
32 lines
920 B
Go
package config
|
|
|
|
import "testing"
|
|
|
|
func TestApplyPlainHTTPBootstrapDisablesConfiguredTLS(t *testing.T) {
|
|
enabled := true
|
|
cfg := &Config{
|
|
Server: ServerConfig{
|
|
TLSEnabled: true,
|
|
TLSAutoSelfSign: true,
|
|
TLSCertPath: "/tmp/server.crt",
|
|
TLSKeyPath: "/tmp/server.key",
|
|
TLSHTTPRedirect: &enabled,
|
|
},
|
|
}
|
|
|
|
ApplyPlainHTTPBootstrap(cfg)
|
|
|
|
if MainWebUIUsesHTTPS(&cfg.Server) {
|
|
t.Fatal("expected --http bootstrap to disable main web UI HTTPS")
|
|
}
|
|
if ServerHTTPRedirectEnabled(&cfg.Server) {
|
|
t.Fatal("expected --http bootstrap to disable HTTP to HTTPS redirect")
|
|
}
|
|
if cfg.Server.TLSCertPath != "" || cfg.Server.TLSKeyPath != "" {
|
|
t.Fatalf("expected TLS cert paths to be cleared, got cert=%q key=%q", cfg.Server.TLSCertPath, cfg.Server.TLSKeyPath)
|
|
}
|
|
if cfg.Server.TLSHTTPRedirect == nil || *cfg.Server.TLSHTTPRedirect {
|
|
t.Fatal("expected TLSHTTPRedirect to be explicitly disabled")
|
|
}
|
|
}
|