MCPcopy Index your code
hub / github.com/ZenNotes/zennotes / newTestServer

Function newTestServer

apps/server/internal/httpserver/security_test.go:25–40  ·  view source on GitHub ↗
(t *testing.T, cfg config.Config)

Source from the content-addressed store, hash-verified

23)
24
25func newTestServer(t *testing.T, cfg config.Config) (*httptest.Server, *vault.Vault) {
26 t.Helper()
27
28 v, err := vault.New(cfg.VaultPath, vault.Options{
29 FileMode: cfg.VaultFileMode,
30 DirMode: cfg.VaultDirMode,
31 MaxAssetBytes: cfg.MaxAssetBytes,
32 })
33 if err != nil {
34 t.Fatalf("vault.New: %v", err)
35 }
36
37 server := httptest.NewServer(New(v, nil, nil, cfg).Router())
38 t.Cleanup(server.Close)
39 return server, v
40}
41
42// loginAndJar logs in with the given token and returns a cookiejar
43// that subsequent calls can reuse.

Calls 2

RouterMethod · 0.80
NewFunction · 0.70

Tested by

no test coverage detected