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

Function seedChatDependenciesWithProvider

coderd/x/chatd/chatd_test.go:6065–6089  ·  view source on GitHub ↗

seedChatDependenciesWithProvider creates a user, organization, chat provider, and model config for the given provider type and base URL.

(
	t *testing.T,
	db database.Store,
	provider string,
	baseURL string,
)

Source from the content-addressed store, hash-verified

6063// chat provider, and model config for the given provider type and
6064// base URL.
6065func seedChatDependenciesWithProvider(
6066 t *testing.T,
6067 db database.Store,
6068 provider string,
6069 baseURL string,
6070) (database.User, database.Organization, database.ChatModelConfig) {
6071 t.Helper()
6072
6073 user := dbgen.User(t, db, database.User{})
6074 org := dbgen.Organization(t, db, database.Organization{})
6075 dbgen.OrganizationMember(t, db, database.OrganizationMember{
6076 UserID: user.ID,
6077 OrganizationID: org.ID,
6078 })
6079 dbgen.ChatProvider(t, db, database.ChatProvider{
6080 Provider: provider,
6081 DisplayName: provider,
6082 BaseUrl: baseURL,
6083 })
6084 model := dbgen.ChatModelConfig(t, db, database.ChatModelConfig{
6085 Provider: provider,
6086 IsDefault: true,
6087 })
6088 return user, org, model
6089}
6090
6091func seedChatDependenciesWithProviderPolicy(
6092 t *testing.T,

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