bf9395e022
CI / license-header (push) Has been skipped
CI / e2e-dry-run (push) Has been skipped
CI / fast-gate (push) Failing after 0s
Test PR Label Logic / test-pr-labels (push) Failing after 1s
Skill Format Check / check-format (push) Failing after 2s
CI / security (push) Failing after 5s
CI / unit-test (push) Has been skipped
CI / lint (push) Has been skipped
CI / script-test (push) Has been skipped
CI / deterministic-gate (push) Has been skipped
CI / coverage (push) Has been skipped
CI / results (push) Has been cancelled
CI / deadcode (push) Has been cancelled
CI / e2e-live (push) Has been cancelled
41 lines
928 B
Go
41 lines
928 B
Go
// Copyright (c) 2026 Lark Technologies Pte. Ltd.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package auth
|
|
|
|
import (
|
|
"bytes"
|
|
"testing"
|
|
|
|
"github.com/larksuite/cli/internal/core"
|
|
)
|
|
|
|
// TestNewUATCallOptions validates the extraction of options from CLI config.
|
|
func TestNewUATCallOptions(t *testing.T) {
|
|
cfg := &core.CliConfig{
|
|
AppID: "app123",
|
|
AppSecret: "secret",
|
|
Brand: core.BrandLark,
|
|
UserOpenId: "ou_test",
|
|
}
|
|
errOut := &bytes.Buffer{}
|
|
|
|
opts := NewUATCallOptions(cfg, errOut)
|
|
|
|
if opts.AppId != "app123" {
|
|
t.Errorf("AppId = %q, want app123", opts.AppId)
|
|
}
|
|
if opts.AppSecret != "secret" {
|
|
t.Errorf("AppSecret = %q, want secret", opts.AppSecret)
|
|
}
|
|
if opts.Domain != core.BrandLark {
|
|
t.Errorf("Domain = %q, want lark", opts.Domain)
|
|
}
|
|
if opts.UserOpenId != "ou_test" {
|
|
t.Errorf("UserOpenId = %q, want ou_test", opts.UserOpenId)
|
|
}
|
|
if opts.ErrOut != errOut {
|
|
t.Error("ErrOut not set correctly")
|
|
}
|
|
}
|