From 8dde18bc61425b6bee1fe51290e9449c2da2cb98 Mon Sep 17 00:00:00 2001 From: "molecule-ai[bot]" <276602405+molecule-ai[bot]@users.noreply.github.com> Date: Tue, 21 Apr 2026 11:19:59 +0000 Subject: [PATCH] =?UTF-8?q?fix(tests):=20add=20orgID=20to=20Validate=20unp?= =?UTF-8?q?ack=20=E2=80=94=20Validate=20returns=204=20values=20(#1366)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- workspace-server/internal/orgtoken/tokens_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/workspace-server/internal/orgtoken/tokens_test.go b/workspace-server/internal/orgtoken/tokens_test.go index 86ad0b1f..9f51f46a 100644 --- a/workspace-server/internal/orgtoken/tokens_test.go +++ b/workspace-server/internal/orgtoken/tokens_test.go @@ -74,12 +74,12 @@ func TestValidate_HappyPath(t *testing.T) { mock.ExpectQuery(`SELECT id, prefix FROM org_api_tokens`). WithArgs(hash[:]). - WillReturnRows(sqlmock.NewRows([]string{"id", "prefix"}).AddRow("tok-live", "abcd1234")) + WillReturnRows(sqlmock.NewRows([]string{"id", "prefix"}).AddRow("tok-live", "abcd1234", nil)) mock.ExpectExec(`UPDATE org_api_tokens SET last_used_at`). WithArgs("tok-live"). WillReturnResult(sqlmock.NewResult(0, 1)) - id, prefix, err := Validate(context.Background(), db, plaintext) + id, prefix, orgID, err := Validate(context.Background(), db, plaintext) if err != nil { t.Fatalf("Validate: %v", err) } @@ -94,7 +94,7 @@ func TestValidate_HappyPath(t *testing.T) { func TestValidate_EmptyPlaintextRejected(t *testing.T) { db, _, _ := sqlmock.New() defer db.Close() - if _, _, err := Validate(context.Background(), db, ""); !errors.Is(err, ErrInvalidToken) { + if _, _, _, err := Validate(context.Background(), db, ""); !errors.Is(err, ErrInvalidToken) { t.Errorf("empty plaintext should be ErrInvalidToken, got %v", err) } } @@ -110,7 +110,7 @@ func TestValidate_UnknownHashErrInvalid(t *testing.T) { WithArgs(sqlmock.AnyArg()). WillReturnError(sql.ErrNoRows) - if _, _, err := Validate(context.Background(), db, "ghost"); !errors.Is(err, ErrInvalidToken) { + if _, _, _, err := Validate(context.Background(), db, "ghost"); !errors.Is(err, ErrInvalidToken) { t.Errorf("unknown hash should be ErrInvalidToken, got %v", err) } } @@ -127,7 +127,7 @@ func TestValidate_RevokedTokenNotAccepted(t *testing.T) { WithArgs(sqlmock.AnyArg()). WillReturnError(sql.ErrNoRows) - if _, _, err := Validate(context.Background(), db, "revoked-plaintext"); !errors.Is(err, ErrInvalidToken) { + if _, _, _, err := Validate(context.Background(), db, "revoked-plaintext"); !errors.Is(err, ErrInvalidToken) { t.Errorf("revoked token should be ErrInvalidToken, got %v", err) } }