MCPcopy Index your code
hub / github.com/coder/coder / seedInternalChatDeps

Function seedInternalChatDeps

coderd/x/chatd/subagent_internal_test.go:176–200  ·  view source on GitHub ↗

seedInternalChatDeps inserts an OpenAI provider and model config into the database and returns the created user, organization, and model. This deliberately does NOT create an Anthropic provider.

(
	t *testing.T,
	db database.Store,
)

Source from the content-addressed store, hash-verified

174// and model. This deliberately does NOT create an Anthropic
175// provider.
176func seedInternalChatDeps(
177 t *testing.T,
178 db database.Store,
179) (database.User, database.Organization, database.ChatModelConfig) {
180 t.Helper()
181
182 user := dbgen.User(t, db, database.User{})
183 org := dbgen.Organization(t, db, database.Organization{})
184 dbgen.OrganizationMember(t, db, database.OrganizationMember{
185 UserID: user.ID,
186 OrganizationID: org.ID,
187 })
188 provider := dbgen.ChatProvider(t, db, database.ChatProvider{
189 Provider: "openai",
190 DisplayName: "OpenAI",
191 })
192
193 model := dbgen.ChatModelConfig(t, db, database.ChatModelConfig{
194 Provider: "openai",
195 AIProviderID: uuid.NullUUID{UUID: provider.ID, Valid: true},
196 IsDefault: true,
197 })
198
199 return user, org, model
200}
201
202// insertEnabledAnthropicProvider inserts an enabled Anthropic provider for
203// the current test user so computer_use flows keep Anthropic credentials

Calls 6

UserFunction · 0.92
OrganizationFunction · 0.92
OrganizationMemberFunction · 0.92
ChatProviderFunction · 0.92
ChatModelConfigFunction · 0.92
HelperMethod · 0.65

Tested by

no test coverage detected