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

Function createUserInbound

internal/serverapi/users_test.go:57–69  ·  view source on GitHub ↗

createUserInbound 辅助:POST /v1/users/{userID}/inbounds,返回 user_inbound 记录 ID。

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

Source from the content-addressed store, hash-verified

55
56// createUserInbound 辅助:POST /v1/users/{userID}/inbounds,返回 user_inbound 记录 ID。
57func createUserInbound(t *testing.T, mux *http.ServeMux, userID, inboundID string) string {
58 t.Helper()
59 body := `{"inbound_id":"` + inboundID + `"}`
60 rec := httptest.NewRecorder()
61 req := httptest.NewRequest(http.MethodPost, "/v1/users/"+userID+"/inbounds", bytes.NewReader([]byte(body)))
62 mux.ServeHTTP(rec, req)
63 if rec.Code != http.StatusOK {
64 t.Fatalf("create user inbound status = %d body=%s", rec.Code, rec.Body.String())
65 }
66 var out map[string]any
67 _ = json.NewDecoder(rec.Body).Decode(&out)
68 return out["id"].(string)
69}
70
71func TestUserSubscriptionAndApplyFlow(t *testing.T) {
72 var capturedConfig string

Calls 2

ServeHTTPMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected