Files
coder/coderd/rbac/error_test.go
Kyle Carberry 22e781eced chore: add /v2 to import module path (#9072)
* chore: add /v2 to import module path

go mod requires semantic versioning with versions greater than 1.x

This was a mechanical update by running:
```
go install github.com/marwan-at-work/mod/cmd/mod@latest
mod upgrade
```

Migrate generated files to import /v2

* Fix gen
2023-08-18 18:55:43 +00:00

33 lines
634 B
Go

package rbac_test
import (
"testing"
"github.com/coder/coder/v2/coderd/rbac"
"github.com/stretchr/testify/require"
"golang.org/x/xerrors"
)
func TestIsUnauthorizedError(t *testing.T) {
t.Parallel()
t.Run("NotWrapped", func(t *testing.T) {
t.Parallel()
errFunc := func() error {
return rbac.UnauthorizedError{}
}
err := errFunc()
require.True(t, rbac.IsUnauthorizedError(err))
})
t.Run("Wrapped", func(t *testing.T) {
t.Parallel()
errFunc := func() error {
return xerrors.Errorf("test error: %w", rbac.UnauthorizedError{})
}
err := errFunc()
require.True(t, rbac.IsUnauthorizedError(err))
})
}