(t *testing.T)
| 1444 | req.Header.Set("Content-Type", "application/json") |
| 1445 | rec := httptest.NewRecorder() |
| 1446 | router.ServeHTTP(rec, req) |
| 1447 | |
| 1448 | if rec.Code != http.StatusBadRequest { |
| 1449 | t.Fatalf("status = %d, want %d: %s", rec.Code, http.StatusBadRequest, rec.Body.String()) |
| 1450 | } |
| 1451 | } |
| 1452 | |
| 1453 | func TestPutWarehouseAllowsCustomProvisioningStates(t *testing.T) { |
| 1454 | store := newFakeAPIStore() |
| 1455 | store.orgs["analytics"] = &configstore.Org{Name: "analytics"} |
| 1456 | router := newTestAPIRouter(store) |
| 1457 | |
| 1458 | body := []byte(`{ |
| 1459 | "duckling_name": "analytics", |
| 1460 | "state": "awaiting-human-approval", |
| 1461 | "metadata_store_state": "vendor-pending", |
| 1462 | "s3_state": "bucket-handshake", |
| 1463 | "identity_state": "iam-review", |
| 1464 | "secrets_state": "waiting-external-secret" |
| 1465 | }`) |
| 1466 | |
| 1467 | req := httptest.NewRequest(http.MethodPut, "/api/v1/orgs/analytics/warehouse", bytes.NewReader(body)) |
| 1468 | req.Header.Set("Content-Type", "application/json") |
| 1469 | rec := httptest.NewRecorder() |
| 1470 | router.ServeHTTP(rec, req) |
| 1471 | |
| 1472 | if rec.Code != http.StatusOK { |
| 1473 | t.Fatalf("status = %d, want %d: %s", rec.Code, http.StatusOK, rec.Body.String()) |
| 1474 | } |
| 1475 | |
| 1476 | warehouse := store.warehouses["analytics"] |
| 1477 | if warehouse == nil { |
| 1478 | t.Fatal("expected stored warehouse") |
| 1479 | return |
| 1480 | } |
| 1481 | if warehouse.State != "awaiting-human-approval" { |
| 1482 | t.Fatalf("expected custom overall state, got %q", warehouse.State) |
| 1483 | } |
nothing calls this directly
no test coverage detected