feat: integrate creator hub douyin workflows
This commit is contained in:
@@ -27,12 +27,6 @@ func TestDouyinGatewayBrowserFencesAccountGeneration(t *testing.T) {
|
||||
t.Fatalf("generation fence missing: %#v", body)
|
||||
}
|
||||
switch request.URL.Path {
|
||||
case "/v1/browsers/account-a/douyin/cookies":
|
||||
cookies, ok := body["cookies"].([]any)
|
||||
if !ok || len(cookies) != 1 {
|
||||
t.Fatalf("cookies missing: %#v", body)
|
||||
}
|
||||
response.WriteHeader(http.StatusNoContent)
|
||||
case "/v1/browsers/account-a/douyin/get":
|
||||
if body["url"] != testDouyinIdentityURL {
|
||||
t.Fatalf("unexpected URL: %#v", body)
|
||||
@@ -44,11 +38,8 @@ func TestDouyinGatewayBrowserFencesAccountGeneration(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
browser := douyinGatewayBrowser{gateway: hub.Gateway{Endpoint: server.URL, Token: "gateway-token-1"}, environment: readyDouyinEnvironment()}
|
||||
if err := browser.SetCookies(context.Background(), []douyin.Cookie{{Name: "sessionid", Value: "private-session", Domain: ".douyin.com", Path: "/"}}); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
result, err := browser.Get(context.Background(), testDouyinIdentityURL)
|
||||
if err != nil || result.Status != 412 || result.Challenge != douyin.ChallengeCaptcha || requests != 2 {
|
||||
if err != nil || result.Status != 412 || result.Challenge != douyin.ChallengeCaptcha || requests != 1 {
|
||||
t.Fatalf("unexpected result: %#v requests=%d err=%v", result, requests, err)
|
||||
}
|
||||
}
|
||||
@@ -72,7 +63,7 @@ func TestDouyinGatewayBrowserDoesNotEchoCredentialOnFailure(t *testing.T) {
|
||||
}))
|
||||
defer server.Close()
|
||||
browser := douyinGatewayBrowser{gateway: hub.Gateway{Endpoint: server.URL, Token: "gateway-token-1"}, environment: readyDouyinEnvironment()}
|
||||
err := browser.SetCookies(context.Background(), []douyin.Cookie{{Name: "sessionid", Value: "private-session", Domain: ".douyin.com", Path: "/"}})
|
||||
_, err := browser.Get(context.Background(), testDouyinIdentityURL)
|
||||
if err == nil || strings.Contains(err.Error(), "private-session") {
|
||||
t.Fatalf("gateway failure leaked credential: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user