MCPcopy Create free account
hub / github.com/asternic/wuzapi / makeTestServer

Function makeTestServer

stdio_test.go:378–404  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

376}
377
378func makeTestServer(t *testing.T) *server {
379 t.Helper()
380
381 // Set admin token for tests
382 testToken := "test-admin-token"
383 *adminToken = testToken
384
385 // Use in-memory database
386 db, err := sqlx.Open("sqlite", ":memory:")
387 if err != nil {
388 t.Fatalf("Failed to create test database: %v", err)
389 }
390 t.Cleanup(func() { db.Close() })
391
392 // Initialize schema using the same function as production
393 if err := initializeSchema(db); err != nil {
394 t.Fatalf("Failed to initialize schema: %v", err)
395 }
396
397 s := &server{
398 db: db,
399 router: mux.NewRouter(),
400 }
401 s.routes()
402
403 return s
404}
405
406// assertJSONRPC20Success checks that a response is a successful JSON-RPC 2.0 response
407// and returns the result data for further assertions

Callers 15

TestGetBlocklistEndpointFunction · 0.85
TestPrivacyEndpointsFunction · 0.85
TestStdioHealthRequestFunction · 0.85
TestAdminUsersAddAndListFunction · 0.85
TestAdminUsersGetFunction · 0.85
TestAdminUsersDeleteFunction · 0.85
TestSessionStatusFunction · 0.85
TestChatSendTextFunction · 0.85
TestChatHistoryFunction · 0.85
TestWebhookUpdateFunction · 0.85
TestWebhookSetFunction · 0.85

Calls 2

routesMethod · 0.95
initializeSchemaFunction · 0.85

Tested by

no test coverage detected