feat(channels): add Shangwutong connector

This commit is contained in:
2026-08-03 10:13:40 +08:00
parent 96f5c796a6
commit 897b4e018f
126 changed files with 20207 additions and 272 deletions
@@ -26,13 +26,11 @@ func setupSocialAuthorizationRouter() *gin.Engine {
}
func TestInstagramAuthorization_ReturnsChatwootPayload(t *testing.T) {
t.Setenv("INSTAGRAM_APP_ID", "instagram-client")
t.Setenv("INSTAGRAM_APP_SECRET", "instagram-secret")
t.Setenv("FRONTEND_URL", "https://app.example.test/")
r := setupSocialAuthorizationRouter()
w := httptest.NewRecorder()
req, _ := http.NewRequest(http.MethodPost, "/api/v1/accounts/42/instagram/authorization", strings.NewReader(`{"return_to":"onboarding"}`))
req, _ := http.NewRequest(http.MethodPost, "/api/v1/accounts/42/instagram/authorization", strings.NewReader(`{"return_to":"onboarding","app_id":"instagram-client","app_secret":"instagram-secret"}`))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
@@ -55,13 +53,12 @@ func TestInstagramAuthorization_ReturnsChatwootPayload(t *testing.T) {
}
func TestTikTokAuthorization_ReturnsChatwootPayload(t *testing.T) {
t.Setenv("TIKTOK_APP_ID", "tiktok-client")
t.Setenv("TIKTOK_APP_SECRET", "tiktok-secret")
t.Setenv("FRONTEND_URL", "https://app.example.test")
r := setupSocialAuthorizationRouter()
w := httptest.NewRecorder()
req, _ := http.NewRequest(http.MethodPost, "/api/v1/accounts/42/tiktok/authorization?return_to=onboarding", nil)
req, _ := http.NewRequest(http.MethodPost, "/api/v1/accounts/42/tiktok/authorization?return_to=onboarding", strings.NewReader(`{"app_id":"tiktok-client","app_secret":"tiktok-secret","return_to":"body-target"}`))
req.Header.Set("Content-Type", "application/json")
r.ServeHTTP(w, req)
assert.Equal(t, http.StatusOK, w.Code)