MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestLoadConfig_AuthToken

Function TestLoadConfig_AuthToken

pkg/mcp/config_test.go:81–95  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

79}
80
81func TestLoadConfig_AuthToken(t *testing.T) {
82 os.Setenv("GOSQLX_MCP_AUTH_TOKEN", "supersecret")
83 defer os.Unsetenv("GOSQLX_MCP_AUTH_TOKEN")
84
85 cfg, err := LoadConfig()
86 if err != nil {
87 t.Fatalf("unexpected error: %v", err)
88 }
89 if !cfg.AuthEnabled() {
90 t.Error("AuthEnabled() = false, want true")
91 }
92 if cfg.AuthToken != "supersecret" {
93 t.Errorf("AuthToken = %q, want %q", cfg.AuthToken, "supersecret")
94 }
95}
96
97func TestLoadConfig_CustomHost(t *testing.T) {
98 os.Setenv("GOSQLX_MCP_HOST", "0.0.0.0")

Callers

nothing calls this directly

Calls 5

AuthEnabledMethod · 0.80
LoadConfigFunction · 0.70
FatalfMethod · 0.65
ErrorfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected