(t *testing.T)
| 1375 | |
| 1376 | req := httptest.NewRequest(http.MethodPut, "/api/v1/orgs/analytics/warehouse", bytes.NewReader(body)) |
| 1377 | req.Header.Set("Content-Type", "application/json") |
| 1378 | rec := httptest.NewRecorder() |
| 1379 | router.ServeHTTP(rec, req) |
| 1380 | |
| 1381 | if rec.Code != http.StatusBadRequest { |
| 1382 | t.Fatalf("status = %d, want %d: %s", rec.Code, http.StatusBadRequest, rec.Body.String()) |
| 1383 | } |
| 1384 | } |
| 1385 | |
| 1386 | func TestPutWarehouseRejectsSecretRefsWithoutWorkerNamespace(t *testing.T) { |
| 1387 | store := newFakeAPIStore() |
| 1388 | store.orgs["analytics"] = &configstore.Org{Name: "analytics"} |
| 1389 | router := newTestAPIRouter(store) |
| 1390 | |
| 1391 | body := []byte(`{ |
| 1392 | "duckling_name": "analytics", |
| 1393 | "worker_identity": { |
| 1394 | "iam_role_arn": "arn:aws:iam::123456789012:role/analytics-worker" |
| 1395 | }, |
| 1396 | "metadata_store_credentials": { |
| 1397 | "namespace": "tenant-b", |
| 1398 | "name": "analytics-metadata", |
| 1399 | "key": "dsn" |
| 1400 | } |
nothing calls this directly
no test coverage detected