MCPcopy Create free account
hub / github.com/PostHog/duckgres / TestCreateOrgRejectsInvalidHostnameAlias

Function TestCreateOrgRejectsInvalidHostnameAlias

controlplane/admin/api_test.go:1446–1480  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

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
1453func 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 }

Callers

nothing calls this directly

Calls 4

newFakeAPIStoreFunction · 0.85
newTestAPIRouterFunction · 0.85
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected