(t *testing.T)
| 173 | } |
| 174 | |
| 175 | func TestOverrideModel(t *testing.T) { |
| 176 | tests := []struct { |
| 177 | overrides []string |
| 178 | expected string |
| 179 | expectedErr string |
| 180 | }{ |
| 181 | { |
| 182 | overrides: []string{"anthropic/claude-4-6"}, |
| 183 | expected: "anthropic/claude-4-6", |
| 184 | }, |
| 185 | { |
| 186 | overrides: []string{"root=anthropic/claude-4-6"}, |
| 187 | expected: "anthropic/claude-4-6", |
| 188 | }, |
| 189 | { |
| 190 | overrides: []string{"missing=anthropic/claude-4-6"}, |
| 191 | expectedErr: "unknown agent 'missing'", |
| 192 | }, |
| 193 | } |
| 194 | |
| 195 | t.Setenv("OPENAI_API_KEY", "asdf") |
| 196 | t.Setenv("ANTHROPIC_API_KEY", "asdf") |
| 197 | |
| 198 | for _, test := range tests { |
| 199 | t.Run(test.expected, func(t *testing.T) { |
| 200 | t.Parallel() |
| 201 | |
| 202 | agentSource, err := config.Resolve("testdata/basic.yaml", nil) |
| 203 | require.NoError(t, err) |
| 204 | |
| 205 | team, err := Load(t.Context(), agentSource, &config.RuntimeConfig{}, withTestProviderRegistry(WithModelOverrides(test.overrides))...) |
| 206 | if test.expectedErr != "" { |
| 207 | require.Contains(t, err.Error(), test.expectedErr) |
| 208 | } else { |
| 209 | require.NoError(t, err) |
| 210 | rootAgent, err := team.Agent("root") |
| 211 | require.NoError(t, err) |
| 212 | require.Equal(t, test.expected, rootAgent.Model(t.Context()).ID().String()) |
| 213 | } |
| 214 | }) |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | func TestTitleModelResolution(t *testing.T) { |
| 219 | t.Setenv("OPENAI_API_KEY", "dummy") |
nothing calls this directly
no test coverage detected