MCPcopy Create free account
hub / github.com/alibaba/open-code-review / TestCustomAPIKeyForSave

Function TestCustomAPIKeyForSave

cmd/opencodereview/provider_tui_test.go:960–982  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

958}
959
960func TestCustomAPIKeyForSave(t *testing.T) {
961 m := providerTUIModel{
962 apiKeyMasked: true,
963 apiKeyOriginal: "keep-me",
964 }
965 key, edited := m.customAPIKeyForSave()
966 if edited {
967 t.Fatal("masked key should not count as edited")
968 }
969 if key != "keep-me" {
970 t.Errorf("key = %q, want keep-me", key)
971 }
972
973 m.apiKeyMasked = false
974 m.apiKeyInput.SetValue(" ")
975 key, edited = m.customAPIKeyForSave()
976 if !edited {
977 t.Fatal("cleared field should count as edited")
978 }
979 if key != "" {
980 t.Errorf("key = %q, want empty", key)
981 }
982}
983
984func TestProviderTUI_CustomFormCreateReturnsToModelList(t *testing.T) {
985 dir := t.TempDir()

Callers

nothing calls this directly

Calls 1

customAPIKeyForSaveMethod · 0.95

Tested by

no test coverage detected