Browse Source
Show slug instead of name for pipelines in index metadata
feature/update-route-registration
Fabian Vowie
3 years ago
No known key found for this signature in database
GPG Key ID: C27317C33B27C410
2 changed files with
2 additions and
2 deletions
-
main.go
-
main_test.go
|
@ -40,7 +40,7 @@ func PipelineHandler(pipeline pipelines.IPipeline, storageProvider storage.IStor |
|
|
func IndexHandler(pipelines []pipelines.IPipeline, w http.ResponseWriter, r *http.Request) { |
|
|
func IndexHandler(pipelines []pipelines.IPipeline, w http.ResponseWriter, r *http.Request) { |
|
|
var pipelineNames []string |
|
|
var pipelineNames []string |
|
|
for _, x := range pipelines { |
|
|
for _, x := range pipelines { |
|
|
pipelineNames = append(pipelineNames, x.GetName()) |
|
|
|
|
|
|
|
|
pipelineNames = append(pipelineNames, x.GetSlug()) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
w.Header().Set("Content-Type", "application/json") |
|
|
|
@ -44,7 +44,7 @@ func TestIndexRoute(t *testing.T) { |
|
|
err = json.Unmarshal(responseRecorder.Body.Bytes(), &body) |
|
|
err = json.Unmarshal(responseRecorder.Body.Bytes(), &body) |
|
|
assert.Nil(t, err) |
|
|
assert.Nil(t, err) |
|
|
assert.Equal(t, 1, len(body.Pipelines)) |
|
|
assert.Equal(t, 1, len(body.Pipelines)) |
|
|
assert.Equal(t, data.Name, body.Pipelines[0]) |
|
|
|
|
|
|
|
|
assert.Equal(t, data.Slug, body.Pipelines[0]) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|