MCPcopy Index your code
hub / github.com/apache/devlake / CreateProject

Method CreateProject

backend/test/helper/api.go:162–195  ·  view source on GitHub ↗
(project *ProjectConfig)

Source from the content-addressed store, hash-verified

160}
161
162func (d *DevlakeClient) CreateProject(project *ProjectConfig) models.ApiOutputProject {
163 var metrics []*models.BaseMetric
164 doraSeen := false
165 for _, p := range project.MetricPlugins {
166 if p.Name == "dora" {
167 doraSeen = true
168 }
169 metrics = append(metrics, &models.BaseMetric{
170 PluginName: p.Name,
171 PluginOption: ToJson(p.Options),
172 Enable: true,
173 })
174 }
175 if project.EnableDora && !doraSeen {
176 metrics = append(metrics, &models.BaseMetric{
177 PluginName: "dora",
178 PluginOption: ToJson(nil),
179 Enable: true,
180 })
181 }
182 return sendHttpRequest[models.ApiOutputProject](d.testCtx, d.timeout, &testContext{
183 client: d,
184 printPayload: true,
185 inlineJson: false,
186 }, http.MethodPost, fmt.Sprintf("%s/projects", d.Endpoint), nil, &models.ApiInputProject{
187 BaseProject: models.BaseProject{
188 Name: project.ProjectName,
189 Description: project.ProjectDescription,
190 },
191 Enable: Val(true),
192 Metrics: metrics,
193 Blueprint: project.Blueprint,
194 })
195}
196
197func (d *DevlakeClient) GetProject(projectName string) models.ApiOutputProject {
198 return sendHttpRequest[models.ApiOutputProject](d.testCtx, d.timeout, &testContext{

Callers 7

TestTestmoPluginFunction · 0.80
createProjectFunction · 0.80
TestAzureFunction · 0.80
TestArgoCDPluginFunction · 0.80
TestGitlabPluginFunction · 0.80
CreateTestBlueprintsFunction · 0.80
PostProjectFunction · 0.80

Calls 3

ToJsonFunction · 0.85
sendHttpRequestFunction · 0.85
ValFunction · 0.85

Tested by 5

TestTestmoPluginFunction · 0.64
createProjectFunction · 0.64
TestAzureFunction · 0.64
TestArgoCDPluginFunction · 0.64
TestGitlabPluginFunction · 0.64