MCPcopy Create free account
hub / github.com/Quorinex/Kiro-Go / TestUpdateSettingsPatchCanExplicitlyDisableAPIKey

Function TestUpdateSettingsPatchCanExplicitlyDisableAPIKey

config/config_test.go:33–56  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

31 t.Fatalf("oauth fields should be cleared: %+v", account)
32 }
33 wantMachine := MachineIdFromAPIKey("ksk_test_key")
34 if account.MachineId != wantMachine {
35 t.Fatalf("machineId = %q, want %q", account.MachineId, wantMachine)
36 }
37 if !IsAPIKeyAccount(&account) {
38 t.Fatal("expected IsAPIKeyAccount true")
39 }
40}
41
42func TestAddAccountRejectsDuplicateAPIKey(t *testing.T) {
43 if err := Init(filepath.Join(t.TempDir(), "config.json")); err != nil {
44 t.Fatalf("init config: %v", err)
45 }
46 first := Account{ID: "api-1", KiroApiKey: "ksk_dup", AuthMethod: "api_key", Enabled: true}
47 if err := AddAccount(first); err != nil {
48 t.Fatalf("add first: %v", err)
49 }
50 second := Account{ID: "api-2", KiroApiKey: "ksk_dup", AuthMethod: "api_key", Enabled: true}
51 if err := AddAccount(second); err != ErrDuplicateAPIKey {
52 t.Fatalf("expected ErrDuplicateAPIKey, got %v", err)
53 }
54}
55
56func TestSplitKiroAPIKeyAndRegionValidation(t *testing.T) {
57 key, region, err := SplitKiroAPIKeyAndRegion("ksk_abc|us-east-1")
58 if err != nil || key != "ksk_abc" || region != "us-east-1" {
59 t.Fatalf("got key=%q region=%q err=%v", key, region, err)

Callers

nothing calls this directly

Calls 6

UpdateSettingsFunction · 0.85
UpdateSettingsPatchFunction · 0.85
GetApiKeyFunction · 0.85
IsApiKeyRequiredFunction · 0.85
GetPasswordFunction · 0.85
InitFunction · 0.70

Tested by

no test coverage detected