MCPcopy Create free account
hub / github.com/cloudquery/cloudquery / fakeCloud

Function fakeCloud

cli/internal/platform/inject_test.go:66–84  ·  view source on GitHub ↗
(t *testing.T, tenants func(w http.ResponseWriter, r *http.Request), session func(w http.ResponseWriter, r *http.Request))

Source from the content-addressed store, hash-verified

64}
65
66func fakeCloud(t *testing.T, tenants func(w http.ResponseWriter, r *http.Request), session func(w http.ResponseWriter, r *http.Request)) *httptest.Server {
67 t.Helper()
68 if tenants == nil {
69 tenants = func(w http.ResponseWriter, _ *http.Request) {
70 writeTenants(w, tenantItem("11111111-1111-1111-1111-111111111111", "active", "team-x"))
71 }
72 }
73 if session == nil {
74 session = func(w http.ResponseWriter, _ *http.Request) {
75 writeSession(w, "cqpd_payload.sig", "https://x.us.platform.cloudquery.io")
76 }
77 }
78 mux := http.NewServeMux()
79 mux.HandleFunc("/user/platform/tenants", tenants)
80 mux.HandleFunc("/platform-destination/session", session)
81 srv := httptest.NewServer(mux)
82 t.Cleanup(srv.Close)
83 return srv
84}
85
86func TestInject_OptIn_AppendsDestination(t *testing.T) {
87 srv := fakeCloud(t, func(w http.ResponseWriter, r *http.Request) {

Calls 3

writeTenantsFunction · 0.85
tenantItemFunction · 0.85
writeSessionFunction · 0.85

Tested by

no test coverage detected