Don't return nil, nil for API service methods. Add tests for updating w/ wrong version. (#396)

This commit is contained in:
Todd Knight authored and GitHub committed 2020-09-21 15:09:30 -04:00
1 parent 1adbe64160
commit 21f5cc274f
20 files changed
+71 -23

No files matched your search

+6
View File
@@ -137,6 +137,12 @@ func TestErrors(t *testing.T) {
assert.Nil(apiErr)
assert.NotNil(hc)
// Updating the wrong version should fail.
_, apiErr, err = pc.Update(tc.Context(), hc.Item.Id, 73, hostcatalogs.WithName("anything"))
require.NoError(err)
assert.NotNil(apiErr)
assert.EqualValues(http.StatusNotFound, apiErr.Status)
_, apiErr, err = pc.Create(tc.Context(), "static", proj.GetPublicId(), hostcatalogs.WithName("foo"))
require.NoError(err)
assert.NotNil(apiErr)