Skip to content

Commit

Permalink
tests: add coverage to GetCloneStatus unit test
Browse files Browse the repository at this point in the history
* this commit add unit test for `GetCloneStatus` handling 404 notFound response cloneEntry doesnt found
* increase the coverage from 0% to
  • Loading branch information
mgold1234 committed Aug 29, 2024
1 parent f2f04a3 commit 17d4224
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/v1/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,21 @@ func TestGetCloneStatus(t *testing.T) {
require.Equal(t, "us-east-2", awsUS.Region)
}

func TestGetCloneEntryNotFoundResponse(t *testing.T) {
id := uuid.New().String()
srv, tokenSrv := startServer(t, &testServerClientsConf{}, nil)
defer func() {
err := srv.Shutdown(context.Background())
require.NoError(t, err)
}()
defer tokenSrv.Close()

respStatusCode, body := tutils.GetResponseBody(t, srv.URL+fmt.Sprintf("/api/image-builder/v1/clones/%s",
id), &tutils.AuthString0)
require.Equal(t, http.StatusNotFound, respStatusCode)
require.Contains(t, body, "Clone not found")
}

func TestValidateSpec(t *testing.T) {
spec, err := GetSwagger()
require.NoError(t, err)
Expand Down

0 comments on commit 17d4224

Please sign in to comment.