MCPcopy Index your code
hub / github.com/coder/coder / TestIsUnauthorizedError

Function TestIsUnauthorizedError

coderd/rbac/error_test.go:12–32  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestIsUnauthorizedError(t *testing.T) {
13 t.Parallel()
14 t.Run("NotWrapped", func(t *testing.T) {
15 t.Parallel()
16 errFunc := func() error {
17 return rbac.UnauthorizedError{}
18 }
19
20 err := errFunc()
21 require.True(t, rbac.IsUnauthorizedError(err))
22 })
23
24 t.Run("Wrapped", func(t *testing.T) {
25 t.Parallel()
26 errFunc := func() error {
27 return xerrors.Errorf("test error: %w", rbac.UnauthorizedError{})
28 }
29 err := errFunc()
30 require.True(t, rbac.IsUnauthorizedError(err))
31 })
32}

Callers

nothing calls this directly

Calls 3

IsUnauthorizedErrorFunction · 0.92
RunMethod · 0.65
ErrorfMethod · 0.45

Tested by

no test coverage detected