mirror of
https://github.com/router-for-me/CLIProxyAPI.git
synced 2026-11-16 22:57:53 +08:00
577 lines
18 KiB
Go
577 lines
18 KiB
Go
package auth
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
"path/filepath"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/MoeForge/moego/json"
|
|
claudeauth "github.com/router-for-me/CLIProxyAPI/v8/internal/auth/claude"
|
|
xaiauth "github.com/router-for-me/CLIProxyAPI/v8/internal/auth/xai"
|
|
"github.com/router-for-me/CLIProxyAPI/v8/internal/config"
|
|
coreauth "github.com/router-for-me/CLIProxyAPI/v8/sdk/cliproxy/auth"
|
|
)
|
|
|
|
type dummyAuthenticator struct {
|
|
provider string
|
|
record *coreauth.Auth
|
|
}
|
|
|
|
func (d *dummyAuthenticator) Provider() string {
|
|
return d.provider
|
|
}
|
|
|
|
func (d *dummyAuthenticator) Login(ctx context.Context, cfg *config.Config, opts *LoginOptions) (*coreauth.Auth, error) {
|
|
return d.record, nil
|
|
}
|
|
|
|
func (d *dummyAuthenticator) RefreshLead() *time.Duration {
|
|
return nil
|
|
}
|
|
|
|
func TestManagerLogin_PreservesExistingAuthFileMetadata(t *testing.T) {
|
|
authDir := t.TempDir()
|
|
fileName := "demo.json"
|
|
filePath := filepath.Join(authDir, fileName)
|
|
|
|
// Pre-populate existing auth file with custom settings
|
|
existing := map[string]any{
|
|
"type": "demo",
|
|
"email": "user@example.com",
|
|
"access_token": "old-token",
|
|
"prefix": "my-prefix",
|
|
"websockets": false,
|
|
"note": "important note",
|
|
"weight": float64(10),
|
|
}
|
|
raw, errMarshal := json.Marshal(existing)
|
|
if errMarshal != nil {
|
|
t.Fatalf("marshal error: %v", errMarshal)
|
|
}
|
|
if errWrite := os.WriteFile(filePath, raw, 0o600); errWrite != nil {
|
|
t.Fatalf("write error: %v", errWrite)
|
|
}
|
|
|
|
newRecord := &coreauth.Auth{
|
|
ID: fileName,
|
|
FileName: fileName,
|
|
Provider: "demo",
|
|
Metadata: map[string]any{
|
|
"type": "demo",
|
|
"email": "user@example.com",
|
|
"access_token": "new-token",
|
|
},
|
|
}
|
|
|
|
store := NewFileTokenStore()
|
|
store.SetBaseDir(authDir)
|
|
|
|
auth := &dummyAuthenticator{
|
|
provider: "demo",
|
|
record: newRecord,
|
|
}
|
|
|
|
mgr := NewManager(store, auth)
|
|
cfg := &config.Config{
|
|
AuthDir: authDir,
|
|
}
|
|
|
|
_, savedPath, errLogin := mgr.Login(context.Background(), "demo", cfg, nil)
|
|
if errLogin != nil {
|
|
t.Fatalf("Login error: %v", errLogin)
|
|
}
|
|
if savedPath != filePath {
|
|
t.Fatalf("savedPath = %s, want %s", savedPath, filePath)
|
|
}
|
|
|
|
savedRaw, errRead := os.ReadFile(filePath)
|
|
if errRead != nil {
|
|
t.Fatalf("ReadFile error: %v", errRead)
|
|
}
|
|
var saved map[string]any
|
|
if errUnmarshal := json.Unmarshal(savedRaw, &saved); errUnmarshal != nil {
|
|
t.Fatalf("Unmarshal error: %v", errUnmarshal)
|
|
}
|
|
|
|
if saved["access_token"] != "new-token" {
|
|
t.Errorf("access_token = %v, want new-token", saved["access_token"])
|
|
}
|
|
if saved["prefix"] != "my-prefix" {
|
|
t.Errorf("prefix = %v, want my-prefix", saved["prefix"])
|
|
}
|
|
if saved["websockets"] != false {
|
|
t.Errorf("websockets = %v, want false", saved["websockets"])
|
|
}
|
|
if saved["note"] != "important note" {
|
|
t.Errorf("note = %v, want important note", saved["note"])
|
|
}
|
|
if saved["weight"] != float64(10) {
|
|
t.Errorf("weight = %v, want 10", saved["weight"])
|
|
}
|
|
}
|
|
|
|
func TestManagerLogin_MigratesMatchingLegacyClaudeCredential(t *testing.T) {
|
|
authDir := t.TempDir()
|
|
legacyFileName := "claude-user@example.com.json"
|
|
targetFileName := claudeauth.CredentialFileName("user@example.com", "organization-a", "account-a")
|
|
legacyPath := filepath.Join(authDir, legacyFileName)
|
|
targetPath := filepath.Join(authDir, targetFileName)
|
|
|
|
existing := map[string]any{
|
|
"type": "claude",
|
|
"email": "user@example.com",
|
|
"organization_uuid": "organization-a",
|
|
"account_uuid": "account-a",
|
|
"access_token": "old-token",
|
|
"prefix": "team",
|
|
"proxy_url": "http://127.0.0.1:8080",
|
|
"disabled": true,
|
|
"weight": float64(5),
|
|
}
|
|
raw, errMarshal := json.Marshal(existing)
|
|
if errMarshal != nil {
|
|
t.Fatalf("marshal legacy credential: %v", errMarshal)
|
|
}
|
|
if errWrite := os.WriteFile(legacyPath, raw, 0o600); errWrite != nil {
|
|
t.Fatalf("write legacy credential: %v", errWrite)
|
|
}
|
|
|
|
newRecord := &coreauth.Auth{
|
|
ID: targetFileName,
|
|
FileName: targetFileName,
|
|
Provider: "claude",
|
|
Storage: &claudeauth.ClaudeTokenStorage{
|
|
Type: "claude",
|
|
Email: "user@example.com",
|
|
OrganizationUUID: "organization-a",
|
|
AccountUUID: "account-a",
|
|
AccessToken: "new-token",
|
|
},
|
|
Metadata: map[string]any{
|
|
"type": "claude",
|
|
"email": "user@example.com",
|
|
"organization_uuid": "organization-a",
|
|
"account_uuid": "account-a",
|
|
"access_token": "new-token",
|
|
},
|
|
}
|
|
|
|
store := NewFileTokenStore()
|
|
store.SetBaseDir(authDir)
|
|
mgr := NewManager(store, &dummyAuthenticator{provider: "claude", record: newRecord})
|
|
|
|
_, savedPath, errLogin := mgr.Login(context.Background(), "claude", &config.Config{AuthDir: authDir}, nil)
|
|
if errLogin != nil {
|
|
t.Fatalf("Login error: %v", errLogin)
|
|
}
|
|
if savedPath != targetPath {
|
|
t.Fatalf("savedPath = %s, want %s", savedPath, targetPath)
|
|
}
|
|
if _, errStat := os.Stat(legacyPath); !os.IsNotExist(errStat) {
|
|
t.Fatalf("legacy credential still exists or stat failed: %v", errStat)
|
|
}
|
|
|
|
savedRaw, errRead := os.ReadFile(targetPath)
|
|
if errRead != nil {
|
|
t.Fatalf("read migrated credential: %v", errRead)
|
|
}
|
|
var saved map[string]any
|
|
if errUnmarshal := json.Unmarshal(savedRaw, &saved); errUnmarshal != nil {
|
|
t.Fatalf("unmarshal migrated credential: %v", errUnmarshal)
|
|
}
|
|
for key, want := range map[string]any{
|
|
"access_token": "new-token",
|
|
"prefix": "team",
|
|
"proxy_url": "http://127.0.0.1:8080",
|
|
"disabled": true,
|
|
"weight": float64(5),
|
|
} {
|
|
if got := saved[key]; got != want {
|
|
t.Errorf("%s = %#v, want %#v", key, got, want)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestManagerLogin_ReloginKeepsCanonicalXAICredential(t *testing.T) {
|
|
authDir := t.TempDir()
|
|
targetFileName := xaiauth.CredentialFileName("a+b@example.com", "sub-first")
|
|
targetPath := filepath.Join(authDir, targetFileName)
|
|
|
|
existing := map[string]any{
|
|
"type": "xai",
|
|
"email": "a+b@example.com",
|
|
"sub": "sub-first",
|
|
"access_token": "old-token",
|
|
"prefix": "team",
|
|
}
|
|
raw, errMarshal := json.Marshal(existing)
|
|
if errMarshal != nil {
|
|
t.Fatalf("marshal canonical credential: %v", errMarshal)
|
|
}
|
|
if errWrite := os.WriteFile(targetPath, raw, 0o600); errWrite != nil {
|
|
t.Fatalf("write canonical credential: %v", errWrite)
|
|
}
|
|
|
|
newRecord := &coreauth.Auth{
|
|
ID: targetFileName,
|
|
FileName: targetFileName,
|
|
Provider: "xai",
|
|
Storage: &xaiauth.TokenStorage{
|
|
Type: "xai",
|
|
Email: "a+b@example.com",
|
|
Subject: "sub-first",
|
|
AccessToken: "new-token",
|
|
},
|
|
Metadata: map[string]any{
|
|
"type": "xai",
|
|
"email": "a+b@example.com",
|
|
"sub": "sub-first",
|
|
"access_token": "new-token",
|
|
},
|
|
}
|
|
|
|
store := NewFileTokenStore()
|
|
store.SetBaseDir(authDir)
|
|
mgr := NewManager(store, &dummyAuthenticator{provider: "xai", record: newRecord})
|
|
|
|
_, savedPath, errLogin := mgr.Login(context.Background(), "xai", &config.Config{AuthDir: authDir}, nil)
|
|
if errLogin != nil {
|
|
t.Fatalf("Login error: %v", errLogin)
|
|
}
|
|
if savedPath != targetPath {
|
|
t.Fatalf("savedPath = %s, want %s", savedPath, targetPath)
|
|
}
|
|
savedRaw, errRead := os.ReadFile(targetPath)
|
|
if errRead != nil {
|
|
t.Fatalf("canonical credential was deleted by re-login: %v", errRead)
|
|
}
|
|
var saved map[string]any
|
|
if errUnmarshal := json.Unmarshal(savedRaw, &saved); errUnmarshal != nil {
|
|
t.Fatalf("unmarshal canonical credential: %v", errUnmarshal)
|
|
}
|
|
if saved["access_token"] != "new-token" || saved["prefix"] != "team" {
|
|
t.Fatalf("saved credential = %#v, want new token with preserved prefix", saved)
|
|
}
|
|
}
|
|
|
|
func TestManagerLogin_SubjectOnlyReloginKeepsEmailCredential(t *testing.T) {
|
|
authDir := t.TempDir()
|
|
emailFileName := xaiauth.CredentialFileName("a+b@example.com", "sub-first")
|
|
emailPath := filepath.Join(authDir, emailFileName)
|
|
|
|
existing := map[string]any{
|
|
"type": "xai",
|
|
"email": "a+b@example.com",
|
|
"sub": "sub-first",
|
|
"access_token": "old-token",
|
|
"prefix": "team",
|
|
"weight": float64(5),
|
|
}
|
|
raw, errMarshal := json.Marshal(existing)
|
|
if errMarshal != nil {
|
|
t.Fatalf("marshal canonical credential: %v", errMarshal)
|
|
}
|
|
if errWrite := os.WriteFile(emailPath, raw, 0o600); errWrite != nil {
|
|
t.Fatalf("write canonical credential: %v", errWrite)
|
|
}
|
|
|
|
// The upstream stops returning an email, so the authenticator names the
|
|
// record after the subject; its identity keys omit the missing email.
|
|
subjectFileName := xaiauth.CredentialFileName("", "sub-first")
|
|
newRecord := &coreauth.Auth{
|
|
ID: subjectFileName,
|
|
FileName: subjectFileName,
|
|
Provider: "xai",
|
|
Storage: &xaiauth.TokenStorage{
|
|
Type: "xai",
|
|
Subject: "sub-first",
|
|
AccessToken: "new-token",
|
|
},
|
|
Metadata: map[string]any{
|
|
"type": "xai",
|
|
"sub": "sub-first",
|
|
"access_token": "new-token",
|
|
},
|
|
}
|
|
|
|
store := NewFileTokenStore()
|
|
store.SetBaseDir(authDir)
|
|
mgr := NewManager(store, &dummyAuthenticator{provider: "xai", record: newRecord})
|
|
|
|
_, savedPath, errLogin := mgr.Login(context.Background(), "xai", &config.Config{AuthDir: authDir}, nil)
|
|
if errLogin != nil {
|
|
t.Fatalf("Login error: %v", errLogin)
|
|
}
|
|
if savedPath != emailPath {
|
|
t.Fatalf("savedPath = %s, want canonical email credential %s", savedPath, emailPath)
|
|
}
|
|
savedRaw, errRead := os.ReadFile(emailPath)
|
|
if errRead != nil {
|
|
t.Fatalf("read canonical credential: %v", errRead)
|
|
}
|
|
var saved map[string]any
|
|
if errUnmarshal := json.Unmarshal(savedRaw, &saved); errUnmarshal != nil {
|
|
t.Fatalf("unmarshal canonical credential: %v", errUnmarshal)
|
|
}
|
|
if saved["access_token"] != "new-token" || saved["prefix"] != "team" || saved["weight"] != float64(5) || saved["email"] != "a+b@example.com" {
|
|
t.Fatalf("saved credential = %#v, want new token with preserved settings and email", saved)
|
|
}
|
|
entries, errReadDir := os.ReadDir(authDir)
|
|
if errReadDir != nil {
|
|
t.Fatalf("ReadDir error: %v", errReadDir)
|
|
}
|
|
if len(entries) != 1 {
|
|
t.Fatalf("auth dir holds %d files, want the single canonical credential", len(entries))
|
|
}
|
|
|
|
// Return leg: the upstream returns the email again, and that login must
|
|
// land on the same canonical file with settings intact, completing the
|
|
// email+subject -> subject-only -> email+subject round trip.
|
|
returnRecord := &coreauth.Auth{
|
|
ID: emailFileName,
|
|
FileName: emailFileName,
|
|
Provider: "xai",
|
|
Storage: &xaiauth.TokenStorage{
|
|
Type: "xai",
|
|
Email: "a+b@example.com",
|
|
Subject: "sub-first",
|
|
AccessToken: "round-trip-token",
|
|
},
|
|
Metadata: map[string]any{
|
|
"type": "xai",
|
|
"email": "a+b@example.com",
|
|
"sub": "sub-first",
|
|
"access_token": "round-trip-token",
|
|
},
|
|
}
|
|
returnMgr := NewManager(store, &dummyAuthenticator{provider: "xai", record: returnRecord})
|
|
_, savedPath, errLogin = returnMgr.Login(context.Background(), "xai", &config.Config{AuthDir: authDir}, nil)
|
|
if errLogin != nil {
|
|
t.Fatalf("return Login error: %v", errLogin)
|
|
}
|
|
if savedPath != emailPath {
|
|
t.Fatalf("return savedPath = %s, want canonical email credential %s", savedPath, emailPath)
|
|
}
|
|
savedRaw, errRead = os.ReadFile(emailPath)
|
|
if errRead != nil {
|
|
t.Fatalf("read round-trip credential: %v", errRead)
|
|
}
|
|
if errUnmarshal := json.Unmarshal(savedRaw, &saved); errUnmarshal != nil {
|
|
t.Fatalf("unmarshal round-trip credential: %v", errUnmarshal)
|
|
}
|
|
if saved["access_token"] != "round-trip-token" || saved["prefix"] != "team" || saved["weight"] != float64(5) || saved["email"] != "a+b@example.com" {
|
|
t.Fatalf("round-trip credential = %#v, want newest token with preserved settings and email", saved)
|
|
}
|
|
entries, errReadDir = os.ReadDir(authDir)
|
|
if errReadDir != nil {
|
|
t.Fatalf("ReadDir error: %v", errReadDir)
|
|
}
|
|
if len(entries) != 1 {
|
|
t.Fatalf("auth dir holds %d files after round trip, want the single canonical credential", len(entries))
|
|
}
|
|
}
|
|
|
|
func TestManagerLogin_DoesNotMigrateLegacyClaudeCredentialFromDifferentOrganization(t *testing.T) {
|
|
authDir := t.TempDir()
|
|
legacyFileName := "claude-user@example.com.json"
|
|
targetFileName := claudeauth.CredentialFileName("user@example.com", "organization-b", "shared-account")
|
|
legacyPath := filepath.Join(authDir, legacyFileName)
|
|
|
|
existing := map[string]any{
|
|
"type": "claude",
|
|
"email": "user@example.com",
|
|
"organization_uuid": "organization-a",
|
|
"account_uuid": "shared-account",
|
|
"access_token": "old-token",
|
|
"prefix": "team",
|
|
}
|
|
raw, errMarshal := json.Marshal(existing)
|
|
if errMarshal != nil {
|
|
t.Fatalf("marshal legacy credential: %v", errMarshal)
|
|
}
|
|
if errWrite := os.WriteFile(legacyPath, raw, 0o600); errWrite != nil {
|
|
t.Fatalf("write legacy credential: %v", errWrite)
|
|
}
|
|
|
|
newRecord := &coreauth.Auth{
|
|
ID: targetFileName,
|
|
FileName: targetFileName,
|
|
Provider: "claude",
|
|
Metadata: map[string]any{
|
|
"type": "claude",
|
|
"email": "user@example.com",
|
|
"organization_uuid": "organization-b",
|
|
"account_uuid": "shared-account",
|
|
"access_token": "new-token",
|
|
},
|
|
}
|
|
|
|
store := NewFileTokenStore()
|
|
store.SetBaseDir(authDir)
|
|
mgr := NewManager(store, &dummyAuthenticator{provider: "claude", record: newRecord})
|
|
|
|
if _, _, errLogin := mgr.Login(context.Background(), "claude", &config.Config{AuthDir: authDir}, nil); errLogin != nil {
|
|
t.Fatalf("Login error: %v", errLogin)
|
|
}
|
|
if _, errStat := os.Stat(legacyPath); errStat != nil {
|
|
t.Fatalf("different-organization legacy credential was removed: %v", errStat)
|
|
}
|
|
|
|
savedRaw, errRead := os.ReadFile(filepath.Join(authDir, targetFileName))
|
|
if errRead != nil {
|
|
t.Fatalf("read new credential: %v", errRead)
|
|
}
|
|
var saved map[string]any
|
|
if errUnmarshal := json.Unmarshal(savedRaw, &saved); errUnmarshal != nil {
|
|
t.Fatalf("unmarshal new credential: %v", errUnmarshal)
|
|
}
|
|
if _, inherited := saved["prefix"]; inherited {
|
|
t.Fatalf("new credential inherited prefix from a different organization: %#v", saved["prefix"])
|
|
}
|
|
}
|
|
|
|
func TestManagerLogin_MultipleOrganizationsSharingEmailCoexist(t *testing.T) {
|
|
authDir := t.TempDir()
|
|
store := NewFileTokenStore()
|
|
store.SetBaseDir(authDir)
|
|
|
|
file1 := claudeauth.CredentialFileName("shared@example.com", "org-team-1", "account-1")
|
|
record1 := &coreauth.Auth{
|
|
ID: file1,
|
|
FileName: file1,
|
|
Provider: "claude",
|
|
Storage: &claudeauth.ClaudeTokenStorage{
|
|
Type: "claude",
|
|
Email: "shared@example.com",
|
|
OrganizationUUID: "org-team-1",
|
|
AccessToken: "token-team",
|
|
},
|
|
Metadata: map[string]any{
|
|
"type": "claude",
|
|
"email": "shared@example.com",
|
|
"organization_uuid": "org-team-1",
|
|
},
|
|
}
|
|
mgr1 := NewManager(store, &dummyAuthenticator{provider: "claude", record: record1})
|
|
_, savedPath1, errLogin1 := mgr1.Login(context.Background(), "claude", &config.Config{AuthDir: authDir}, nil)
|
|
if errLogin1 != nil {
|
|
t.Fatalf("Login 1 error: %v", errLogin1)
|
|
}
|
|
|
|
file2 := claudeauth.CredentialFileName("shared@example.com", "org-enterprise-2", "account-1")
|
|
record2 := &coreauth.Auth{
|
|
ID: file2,
|
|
FileName: file2,
|
|
Provider: "claude",
|
|
Storage: &claudeauth.ClaudeTokenStorage{
|
|
Type: "claude",
|
|
Email: "shared@example.com",
|
|
OrganizationUUID: "org-enterprise-2",
|
|
AccessToken: "token-enterprise",
|
|
},
|
|
Metadata: map[string]any{
|
|
"type": "claude",
|
|
"email": "shared@example.com",
|
|
"organization_uuid": "org-enterprise-2",
|
|
},
|
|
}
|
|
mgr2 := NewManager(store, &dummyAuthenticator{provider: "claude", record: record2})
|
|
_, savedPath2, errLogin2 := mgr2.Login(context.Background(), "claude", &config.Config{AuthDir: authDir}, nil)
|
|
if errLogin2 != nil {
|
|
t.Fatalf("Login 2 error: %v", errLogin2)
|
|
}
|
|
|
|
if savedPath1 == savedPath2 {
|
|
t.Fatalf("savedPath1 and savedPath2 are identical: %s; expected distinct files", savedPath1)
|
|
}
|
|
|
|
records, errList := store.List(context.Background())
|
|
if errList != nil {
|
|
t.Fatalf("store.List error: %v", errList)
|
|
}
|
|
if len(records) != 2 {
|
|
t.Fatalf("store.List returned %d records, want 2 distinct organization records", len(records))
|
|
}
|
|
}
|
|
|
|
func TestManagerLogin_MigratesMatchingLegacyXAICredential(t *testing.T) {
|
|
authDir := t.TempDir()
|
|
legacyFileName := "xai-a-b@example.com.json"
|
|
targetFileName := xaiauth.CredentialFileName("a+b@example.com", "sub-first")
|
|
legacyPath := filepath.Join(authDir, legacyFileName)
|
|
targetPath := filepath.Join(authDir, targetFileName)
|
|
|
|
existing := map[string]any{
|
|
"type": "xai",
|
|
"email": "a+b@example.com",
|
|
"sub": "sub-first",
|
|
"access_token": "old-token",
|
|
"prefix": "team",
|
|
"proxy_url": "http://127.0.0.1:8080",
|
|
"disabled": true,
|
|
"weight": float64(5),
|
|
}
|
|
raw, errMarshal := json.Marshal(existing)
|
|
if errMarshal != nil {
|
|
t.Fatalf("marshal legacy credential: %v", errMarshal)
|
|
}
|
|
if errWrite := os.WriteFile(legacyPath, raw, 0o600); errWrite != nil {
|
|
t.Fatalf("write legacy credential: %v", errWrite)
|
|
}
|
|
|
|
newRecord := &coreauth.Auth{
|
|
ID: targetFileName,
|
|
FileName: targetFileName,
|
|
Provider: "xai",
|
|
Storage: &xaiauth.TokenStorage{
|
|
Type: "xai",
|
|
Email: "a+b@example.com",
|
|
Subject: "sub-first",
|
|
AccessToken: "new-token",
|
|
},
|
|
Metadata: map[string]any{
|
|
"type": "xai",
|
|
"email": "a+b@example.com",
|
|
"sub": "sub-first",
|
|
"access_token": "new-token",
|
|
},
|
|
}
|
|
|
|
store := NewFileTokenStore()
|
|
store.SetBaseDir(authDir)
|
|
mgr := NewManager(store, &dummyAuthenticator{provider: "xai", record: newRecord})
|
|
|
|
_, savedPath, errLogin := mgr.Login(context.Background(), "xai", &config.Config{AuthDir: authDir}, nil)
|
|
if errLogin != nil {
|
|
t.Fatalf("Login error: %v", errLogin)
|
|
}
|
|
if savedPath != targetPath {
|
|
t.Fatalf("savedPath = %s, want %s", savedPath, targetPath)
|
|
}
|
|
if _, errStat := os.Stat(legacyPath); !os.IsNotExist(errStat) {
|
|
t.Fatalf("legacy credential still exists or stat failed: %v", errStat)
|
|
}
|
|
|
|
savedRaw, errRead := os.ReadFile(targetPath)
|
|
if errRead != nil {
|
|
t.Fatalf("read migrated credential: %v", errRead)
|
|
}
|
|
var saved map[string]any
|
|
if errUnmarshal := json.Unmarshal(savedRaw, &saved); errUnmarshal != nil {
|
|
t.Fatalf("unmarshal migrated credential: %v", errUnmarshal)
|
|
}
|
|
for key, want := range map[string]any{
|
|
"access_token": "new-token",
|
|
"prefix": "team",
|
|
"proxy_url": "http://127.0.0.1:8080",
|
|
"disabled": true,
|
|
"weight": float64(5),
|
|
} {
|
|
if got := saved[key]; got != want {
|
|
t.Errorf("%s = %#v, want %#v", key, got, want)
|
|
}
|
|
}
|
|
}
|