Files
digital-psychology/apps/api/internal/integration/auth_logout_test.go
T
jackyu66gitandCursor 5ceb3ce749
ci / h5 (push) Canceled after 0s
ci / api (push) Canceled after 0s
ci / ess-docs (push) Canceled after 0s
feat(ECR-010): Ops-E 系统运营;修复登出解绑;P2 Complete
落地管理员 RBAC/封禁/推送任务 stub,logout 解绑 device 并统一各页 ensureAccount,同时收口 P2 生日生成与状态文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-11 18:54:59 +08:00

26 lines
702 B
Go

package integration_test
import (
"net/http"
"testing"
)
// Logout must revoke session AND unbind device so refresh is not still "logged in".
func TestAuthLogoutUnbindsDevice(t *testing.T) {
r, _ := setupAPI(t)
key := mustRegister(t, r)
_, key = doJSON(t, r, http.MethodGet, "/api/v1/auth/me", nil, key)
_, key = doJSON(t, r, http.MethodPost, "/api/v1/auth/logout", nil, key)
testBearer = ""
_, _, status := doJSONExpect(t, r, http.MethodGet, "/api/v1/auth/me", nil, key, 40112)
if status != http.StatusUnauthorized {
t.Fatalf("after logout GET /auth/me want HTTP 401, got %d", status)
}
_, key, _ = doJSONExpect(t, r, http.MethodGet, "/api/v1/profiles", nil, key, 40112)
_ = key
}