MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / createUser

Function createUser

internal/serverapi/users_test.go:43–54  ·  view source on GitHub ↗

createUser 辅助:POST /v1/users,返回 user ID。

(t *testing.T, mux *http.ServeMux, body string)

Source from the content-addressed store, hash-verified

41
42// createUser 辅助:POST /v1/users,返回 user ID。
43func createUser(t *testing.T, mux *http.ServeMux, body string) string {
44 t.Helper()
45 rec := httptest.NewRecorder()
46 req := httptest.NewRequest(http.MethodPost, "/v1/users", bytes.NewReader([]byte(body)))
47 mux.ServeHTTP(rec, req)
48 if rec.Code != http.StatusOK {
49 t.Fatalf("create user status = %d body=%s", rec.Code, rec.Body.String())
50 }
51 var out map[string]any
52 _ = json.NewDecoder(rec.Body).Decode(&out)
53 return out["id"].(string)
54}
55
56// createUserInbound 辅助:POST /v1/users/{userID}/inbounds,返回 user_inbound 记录 ID。
57func createUserInbound(t *testing.T, mux *http.ServeMux, userID, inboundID string) string {

Calls 2

ServeHTTPMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected