MCPcopy Create free account
hub / github.com/docker/docker-agent / TestModelsListCommand_JSONFormat

Function TestModelsListCommand_JSONFormat

cmd/root/models_test.go:110–134  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

108}
109
110func TestModelsListCommand_JSONFormat(t *testing.T) {
111 t.Parallel()
112
113 var buf bytes.Buffer
114 cmd := newModelsCmd(withTestConfig(map[string]string{"ANTHROPIC_API_KEY": "test-key"}))
115 cmd.SetOut(&buf)
116 cmd.SetErr(&buf)
117 cmd.SetArgs([]string{"--format", "json"})
118
119 require.NoError(t, cmd.Execute())
120
121 var rows []modelRow
122 require.NoError(t, json.Unmarshal(buf.Bytes(), &rows))
123 assert.NotEmpty(t, rows)
124
125 // At least one should be the default
126 hasDefault := false
127 for _, r := range rows {
128 if r.Default {
129 hasDefault = true
130 break
131 }
132 }
133 assert.True(t, hasDefault, "expected at least one default model")
134}
135
136func TestModelsListCommand_DefaultMarker(t *testing.T) {
137 t.Parallel()

Callers

nothing calls this directly

Calls 4

BytesMethod · 0.95
newModelsCmdFunction · 0.85
withTestConfigFunction · 0.85
ExecuteMethod · 0.45

Tested by

no test coverage detected