MCPcopy Index your code
hub / github.com/cloudquery/cloudquery / TestDetectTenant_CloudPath

Function TestDetectTenant_CloudPath

cli/internal/platform/inject_test.go:215–227  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

213}
214
215func TestDetectTenant_CloudPath(t *testing.T) {
216 srv := fakeCloud(t, func(w http.ResponseWriter, _ *http.Request) {
217 w.Header().Set("Content-Type", "application/json")
218 _ = json.NewEncoder(w).Encode(map[string]any{"items": []map[string]any{
219 {"tenant_id": "11111111-1111-1111-1111-111111111111", "status": "active", "team_name": "team-x", "host": "acme.us.platform.cloudquery.io", "subdomain": "acme"},
220 }})
221 }, nil)
222 t.Setenv(envAPIURL, srv.URL)
223
224 url, ok := DetectTenant(context.Background(), "tok", "team-x")
225 require.True(t, ok)
226 require.Equal(t, "https://acme.us.platform.cloudquery.io", url, "url is built from the active tenant's host")
227}
228
229// DetectTenant must make the SAME multi-tenant decision auto-injection does:
230// skip (report nothing) when a team has several active tenants and no

Callers

nothing calls this directly

Calls 4

fakeCloudFunction · 0.85
DetectTenantFunction · 0.85
SetMethod · 0.45
HeaderMethod · 0.45

Tested by

no test coverage detected