images: Support updating distribution and description. (#413)

This commit is contained in:
Andrew Starr-Bochicchio 2020-11-13 12:42:15 -05:00 committed by GitHub
parent f70bf7fdf2
commit 45fcf9e782
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -52,7 +52,9 @@ type Image struct {
// ImageUpdateRequest represents a request to update an image.
type ImageUpdateRequest struct {
Name string `json:"name"`
Name string `json:"name,omitempty"`
Distribution string `json:"distribution,omitempty"`
Description string `json:"description,omitempty"`
}
// CustomImageCreateRequest represents a request to create a custom image.

View File

@ -353,12 +353,16 @@ func TestImages_Update(t *testing.T) {
defer teardown()
updateRequest := &ImageUpdateRequest{
Name: "name",
Name: "name",
Distribution: "Fedora",
Description: "Just testing...",
}
mux.HandleFunc("/v2/images/12345", func(w http.ResponseWriter, r *http.Request) {
expected := map[string]interface{}{
"name": "name",
"name": "name",
"distribution": "Fedora",
"description": "Just testing...",
}
var v map[string]interface{}