| 77 | } |
| 78 | |
| 79 | func TestAuthErrorCode_String(t *testing.T) { |
| 80 | as := assert.New(t) |
| 81 | tests := []struct { |
| 82 | name string |
| 83 | code AuthErrorCode |
| 84 | want string |
| 85 | }{ |
| 86 | { |
| 87 | name: "AuthorizationPending", |
| 88 | code: AuthorizationPending, |
| 89 | want: "authorization_pending", |
| 90 | }, |
| 91 | { |
| 92 | name: "SlowDown", |
| 93 | code: SlowDown, |
| 94 | want: "slow_down", |
| 95 | }, |
| 96 | { |
| 97 | name: "AccessDenied", |
| 98 | code: AccessDenied, |
| 99 | want: "access_denied", |
| 100 | }, |
| 101 | { |
| 102 | name: "ExpiredToken", |
| 103 | code: ExpiredToken, |
| 104 | want: "expired_token", |
| 105 | }, |
| 106 | } |
| 107 | |
| 108 | for _, tt := range tests { |
| 109 | t.Run(tt.name, func(t *testing.T) { |
| 110 | as.Equal(tt.want, tt.code.String()) |
| 111 | }) |
| 112 | } |
| 113 | } |
| 114 | |
| 115 | func TestNewCozeAuthExceptionWithoutParent(t *testing.T) { |
| 116 | as := assert.New(t) |