MCPcopy
hub / github.com/benbjohnson/wtf / MustOpenServer

Function MustOpenServer

http/server_test.go:37–59  ·  view source on GitHub ↗

MustOpenServer is a test helper function for starting a new test HTTP server. Fail on error.

(tb testing.TB)

Source from the content-addressed store, hash-verified

35// MustOpenServer is a test helper function for starting a new test HTTP server.
36// Fail on error.
37func MustOpenServer(tb testing.TB) *Server {
38 tb.Helper()
39
40 // Initialize wrapper and set test configuration settings.
41 s := &Server{Server: wtfhttp.NewServer()}
42 s.HashKey = TestHashKey
43 s.BlockKey = TestBlockKey
44 s.GitHubClientID = TestGitHubClientID
45 s.GitHubClientSecret = TestGitHubClientSecret
46
47 // Assign mocks to actual server's services.
48 s.Server.AuthService = &s.AuthService
49 s.Server.DialService = &s.DialService
50 s.Server.DialMembershipService = &s.DialMembershipService
51 s.Server.EventService = &s.EventService
52 s.Server.UserService = &s.UserService
53
54 // Begin running test server.
55 if err := s.Open(); err != nil {
56 tb.Fatal(err)
57 }
58 return s
59}
60
61// MustCloseServer is a test helper function for shutting down the server.
62// Fail on error.

Callers 2

TestLogin_OAuth_GitHubFunction · 0.85
TestDialIndexFunction · 0.85

Calls 1

OpenMethod · 0.95

Tested by

no test coverage detected