Skip to content

Commit

Permalink
add delete function fail and validate error type and message check fo…
Browse files Browse the repository at this point in the history
…r DeleteProjectDomainAttributes

Signed-off-by: Arthur <[email protected]>
  • Loading branch information
luckyarthur committed Nov 12, 2024
1 parent ef026eb commit bd5998e
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -500,14 +500,19 @@ func TestDeleteProjectDomainAttributes(t *testing.T) {
}
_, failError := manager.DeleteProjectDomainAttributes(context.Background(), request)
assert.Error(t, failError)
var newError errors.FlyteAdminError
assert.ErrorAs(t, failError, &newError)
assert.Equal(t, newError.Error(), "failError")

db.ProjectRepo().(*mocks.MockProjectRepo).GetFunction = func(
ctx context.Context, projectID string) (models.Project, error) {
return models.Project{}, errors.NewFlyteAdminError(codes.NotFound, "validationError")
}
_, validationError := manager.DeleteProjectDomainAttributes(context.Background(), request)
assert.Error(t, validationError)

var secondError errors.FlyteAdminError
assert.ErrorAs(t, validationError, &secondError)
assert.Equal(t, secondError.Error(), "failed to validate that project [project] and domain [domain] are registered, err: [validationError]")
}

func TestUpdateProjectAttributes(t *testing.T) {
Expand Down

0 comments on commit bd5998e

Please sign in to comment.