(t *testing.T, tenants func(w http.ResponseWriter, r *http.Request), session func(w http.ResponseWriter, r *http.Request))
| 64 | } |
| 65 | |
| 66 | func 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 | |
| 86 | func TestInject_OptIn_AppendsDestination(t *testing.T) { |
| 87 | srv := fakeCloud(t, func(w http.ResponseWriter, r *http.Request) { |
no test coverage detected