feat(copilot): finish configuration center

This commit is contained in:
2026-07-13 14:57:28 +08:00
parent 0a69d80f7c
commit 8b9eedc0e2
60 changed files with 3040 additions and 1042 deletions
@@ -146,6 +146,28 @@ func TestChatwootAuthValidateTokenReturnsPayloadData(t *testing.T) {
assertChatwootAuthUserFixture(t, data)
}
func TestChatwootAuthValidateTokenSerializesPlatformAdminType(t *testing.T) {
router, db, user := setupChatwootAuthTest(t)
require.NoError(t, db.Model(user).Updates(map[string]any{
"role": "super_admin",
"type": "User",
}).Error)
token := signInAndReturnAccessToken(t, router)
req, _ := http.NewRequest(http.MethodGet, "/auth/validate_token", nil)
req.Header.Set("access-token", token)
w := httptest.NewRecorder()
router.ServeHTTP(w, req)
require.Equal(t, http.StatusOK, w.Code)
var body map[string]any
require.NoError(t, json.Unmarshal(w.Body.Bytes(), &body))
data := body["payload"].(map[string]any)["data"].(map[string]any)
require.Equal(t, "SuperAdmin", data["type"])
require.Equal(t, "administrator", data["role"])
}
func TestChatwootAuthSignOutRevokesRefreshSession(t *testing.T) {
router, _, _ := setupChatwootAuthTest(t)
token := signInAndReturnAccessToken(t, router)