MCPcopy
hub / github.com/bettercap/bettercap / TestServerConfiguration

Function TestServerConfiguration

modules/api_rest/api_rest_test.go:308–330  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

306}
307
308func TestServerConfiguration(t *testing.T) {
309 s := createMockSession(t)
310 mod := NewRestAPI(s)
311
312 // Set valid parameters
313 s.Env.Set("api.rest.address", "127.0.0.1")
314 s.Env.Set("api.rest.port", "8081")
315 s.Env.Set("api.rest.username", "testuser")
316 s.Env.Set("api.rest.password", "testpass")
317 s.Env.Set("api.rest.websocket", "true")
318 s.Env.Set("api.rest.alloworigin", "http://localhost:3000")
319
320 // This might fail due to TLS cert generation, but we're testing the flow
321 _ = mod.Configure()
322
323 // Check that values were set
324 if mod.username != "" && mod.username != "testuser" {
325 t.Logf("Username set to: %s", mod.username)
326 }
327 if mod.password != "" && mod.password != "testpass" {
328 t.Logf("Password set to: %s", mod.password)
329 }
330}
331
332func TestQuitChannel(t *testing.T) {
333 s := createMockSession(t)

Callers

nothing calls this directly

Calls 4

ConfigureMethod · 0.95
NewRestAPIFunction · 0.85
createMockSessionFunction · 0.70
SetMethod · 0.45

Tested by

no test coverage detected