This commit is contained in:
@@ -42,8 +42,8 @@ func rawCall(t *testing.T, c apiClient, method, path string, body []byte, header
|
||||
// one of them win and the other observe the committed count.
|
||||
func TestConcurrentAdminDemotionsKeepOneAdmin(t *testing.T) {
|
||||
srv, d := testServerDB(t)
|
||||
a, _ := accountClient(t, srv.URL, "admin-a@computer.test")
|
||||
b, bID := accountClient(t, srv.URL, "admin-b@computer.test")
|
||||
a, _ := accountClient(t, srv.URL, "admin-a@superbrain.test")
|
||||
b, bID := accountClient(t, srv.URL, "admin-b@superbrain.test")
|
||||
a.request("PATCH", "/api/admin/users", map[string]any{"userId": bID, "role": "ADMIN"}, 200)
|
||||
|
||||
aID := meID(a)
|
||||
@@ -93,7 +93,7 @@ func TestSignupTrimsWhitespaceName(t *testing.T) {
|
||||
srv, _ := testServerDB(t)
|
||||
jar, _ := cookiejar.New(nil)
|
||||
c := apiClient{t, &http.Client{Jar: jar}, srv.URL}
|
||||
body := map[string]any{"email": "trimmed@computer.test", "password": "test-long-password", "name": " "}
|
||||
body := map[string]any{"email": "trimmed@superbrain.test", "password": "test-long-password", "name": " "}
|
||||
c.request("POST", "/api/signup", body, 201)
|
||||
c.request("POST", "/api/auth/login", body, 200)
|
||||
me := c.request("GET", "/api/me", nil, 200)
|
||||
@@ -107,7 +107,7 @@ func TestSignupTrimsWhitespaceName(t *testing.T) {
|
||||
// INSERT per id inside a user-locked transaction.
|
||||
func TestShareRecipientListsAreCapped(t *testing.T) {
|
||||
srv, _ := testServerDB(t)
|
||||
owner, _ := accountClient(t, srv.URL, "cap-owner@computer.test")
|
||||
owner, _ := accountClient(t, srv.URL, "cap-owner@superbrain.test")
|
||||
id := owner.request("POST", "/api/bookmarks", map[string]any{"url": "https://example.com/cap"}, 201)["id"].(string)
|
||||
|
||||
tooMany := make([]string, maxTestShareRecipients+1)
|
||||
@@ -132,7 +132,7 @@ const (
|
||||
// Review L-8: an oversized direct API body is 413, not a misleading 400.
|
||||
func TestOversizedDirectBodyReturns413(t *testing.T) {
|
||||
srv, _ := testServerDB(t)
|
||||
owner, _ := accountClient(t, srv.URL, "oversized@computer.test")
|
||||
owner, _ := accountClient(t, srv.URL, "oversized@superbrain.test")
|
||||
body := []byte(`{"url":"https://example.com","notes":"` + strings.Repeat("a", 1<<20) + `"}`)
|
||||
status, _ := rawCall(t, owner, "POST", "/api/bookmarks", body, nil)
|
||||
if status != http.StatusRequestEntityTooLarge {
|
||||
@@ -144,7 +144,7 @@ func TestOversizedDirectBodyReturns413(t *testing.T) {
|
||||
// endpoints, while an idempotent same-origin call still succeeds.
|
||||
func TestSignoutRejectsCrossOrigin(t *testing.T) {
|
||||
srv, _ := testServerDB(t)
|
||||
owner, _ := accountClient(t, srv.URL, "signout@computer.test")
|
||||
owner, _ := accountClient(t, srv.URL, "signout@superbrain.test")
|
||||
body := []byte(`{}`)
|
||||
status, _ := rawCall(t, owner, "POST", "/api/auth/signout", body, map[string]string{"Origin": "https://attacker.invalid"})
|
||||
if status != http.StatusForbidden {
|
||||
@@ -160,7 +160,7 @@ func TestSignoutRejectsCrossOrigin(t *testing.T) {
|
||||
// groups instead of trusting a client to keep them apart.
|
||||
func TestPageReorderKeepsPinnedGrouping(t *testing.T) {
|
||||
srv, _ := testServerDB(t)
|
||||
owner, _ := accountClient(t, srv.URL, "reorder@computer.test")
|
||||
owner, _ := accountClient(t, srv.URL, "reorder@superbrain.test")
|
||||
pinned := owner.request("POST", "/api/pages", map[string]any{"title": "Pinned", "pinned": true}, 201)["id"].(string)
|
||||
second := owner.request("POST", "/api/pages", map[string]any{"title": "Second"}, 201)["id"].(string)
|
||||
third := owner.request("POST", "/api/pages", map[string]any{"title": "Third"}, 201)["id"].(string)
|
||||
@@ -193,7 +193,7 @@ func TestPageReorderKeepsPinnedGrouping(t *testing.T) {
|
||||
// rejected instead of silently discarded.
|
||||
func TestPropertyConfigRejectsMalformedValues(t *testing.T) {
|
||||
srv, _ := testServerDB(t)
|
||||
owner, _ := accountClient(t, srv.URL, "props@computer.test")
|
||||
owner, _ := accountClient(t, srv.URL, "props@superbrain.test")
|
||||
cid := owner.request("POST", "/api/collections", map[string]any{"name": "Config"}, 201)["id"].(string)
|
||||
for _, cfg := range []any{"x", []any{}, 5, true} {
|
||||
owner.request("POST", "/api/collections/"+cid+"/properties", map[string]any{"name": "Bad", "type": "TEXT", "config": cfg}, 400)
|
||||
@@ -206,8 +206,8 @@ func TestPropertyConfigRejectsMalformedValues(t *testing.T) {
|
||||
// creating duplicate calendar entries.
|
||||
func TestSharedDateReshareIsIdempotent(t *testing.T) {
|
||||
srv, _ := testServerDB(t)
|
||||
owner, _ := accountClient(t, srv.URL, "dates-owner@computer.test")
|
||||
_, recipientID := accountClient(t, srv.URL, "dates-recipient@computer.test")
|
||||
owner, _ := accountClient(t, srv.URL, "dates-owner@superbrain.test")
|
||||
_, recipientID := accountClient(t, srv.URL, "dates-recipient@superbrain.test")
|
||||
|
||||
post := func(note string) []map[string]any {
|
||||
body, _ := json.Marshal(map[string]any{"date": "2026-11-05", "note": note, "recipientIds": []string{recipientID}})
|
||||
@@ -258,7 +258,7 @@ func TestSharedDateReshareIsIdempotent(t *testing.T) {
|
||||
func TestCardDAVRejectsNonStandardPort(t *testing.T) {
|
||||
srv, _ := testServerDB(t)
|
||||
t.Setenv("INTEGRATIONS_ALLOW_PRIVATE", "0")
|
||||
owner, _ := accountClient(t, srv.URL, "carddav@computer.test")
|
||||
owner, _ := accountClient(t, srv.URL, "carddav@superbrain.test")
|
||||
v := owner.request("POST", "/api/contacts/sync", map[string]any{
|
||||
"nextcloudUrl": "https://198.51.100.10:8443",
|
||||
"username": "user",
|
||||
@@ -274,7 +274,7 @@ func TestCardDAVRejectsNonStandardPort(t *testing.T) {
|
||||
// renumbers positions contiguously, so reload order is deterministic.
|
||||
func TestColumnDeleteNormalizesMovedCardPositions(t *testing.T) {
|
||||
srv, _ := testServerDB(t)
|
||||
owner, _ := accountClient(t, srv.URL, "columns@computer.test")
|
||||
owner, _ := accountClient(t, srv.URL, "columns@superbrain.test")
|
||||
var columns []map[string]any
|
||||
res, err := owner.c.Get(srv.URL + "/api/kanban/columns")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user