MCPcopy Create free account
hub / github.com/GoMudEngine/GoMud / TestHTTPSSetupAutoModeRejectsLocalhost

Function TestHTTPSSetupAutoModeRejectsLocalhost

scripts/https_setup_test.go:393–414  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

391}
392
393func TestHTTPSSetupAutoModeRejectsLocalhost(t *testing.T) {
394 configPath := writeHTTPSSetupTempConfig(t, sampleHTTPSConfig)
395
396 input := strings.Join([]string{
397 "2",
398 "localhost",
399 "",
400 }, "\n")
401
402 output, err := runHTTPSSetupExpectError(t, configPath, input, nil)
403 if err == nil {
404 t.Fatalf("https-setup.sh unexpectedly succeeded for localhost")
405 }
406 if !strings.Contains(output, "Automatic HTTPS requires a public hostname") {
407 t.Fatalf("https-setup.sh output did not explain invalid hostname:\n%s", output)
408 }
409
410 updated := readHTTPSSetupConfig(t, configPath)
411 if updated != sampleHTTPSConfig {
412 t.Fatalf("https-setup config changed after invalid auto mode input:\n%s", updated)
413 }
414}
415
416func TestHTTPSSetupAutoModeNormalizesPastedHostname(t *testing.T) {
417 configPath := writeHTTPSSetupTempConfig(t, sampleHTTPSConfig)

Callers

nothing calls this directly

Calls 3

runHTTPSSetupExpectErrorFunction · 0.85
readHTTPSSetupConfigFunction · 0.85

Tested by

no test coverage detected