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

Function TestGetOrgIncludesWarehouse

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

Source from the content-addressed store, hash-verified

493 req := httptest.NewRequest(http.MethodPost, "/api/v1/users", bytes.NewReader(body))
494 req.Header.Set("Content-Type", "application/json")
495 rec := httptest.NewRecorder()
496 router.ServeHTTP(rec, req)
497
498 if rec.Code != http.StatusCreated {
499 t.Fatalf("status = %d, want %d: %s", rec.Code, http.StatusCreated, rec.Body.String())
500 }
501 user := store.users["analytics/analyst"]
502 if user == nil {
503 t.Fatal("expected user to be created")
504 }
505 if user.MaxVCPUs != 8 {
506 t.Fatalf("MaxVCPUs = %d, want 8", user.MaxVCPUs)
507 }
508}
509
510func TestCreateUserRejectsNegativeMaxVCPUs(t *testing.T) {
511 store := newFakeAPIStore()
512 router := newTestAPIRouter(store)
513
514 body := []byte(`{
515 "org_id": "analytics",
516 "username": "analyst",
517 "password": "secret",
518 "max_vcpus": -1
519 }`)
520 req := httptest.NewRequest(http.MethodPost, "/api/v1/users", bytes.NewReader(body))
521 req.Header.Set("Content-Type", "application/json")
522 rec := httptest.NewRecorder()
523 router.ServeHTTP(rec, req)
524

Callers

nothing calls this directly

Calls 4

newFakeAPIStoreFunction · 0.85
seedOrgWithWarehouseFunction · 0.85
newTestAPIRouterFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected