-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
consent: Better defaults for consent denied errors (#1297)
Closes #1285 Signed-off-by: Kevin Minehart <kmineh0151@gmail.com>
- Loading branch information
Showing
4 changed files
with
87 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package consent | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/ory/fosite" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestToRFCError(t *testing.T) { | ||
for k, tc := range []struct { | ||
input *RequestDeniedError | ||
expect *fosite.RFC6749Error | ||
}{ | ||
{ | ||
input: &RequestDeniedError{ | ||
Name: "not empty", | ||
}, | ||
expect: &fosite.RFC6749Error{ | ||
Name: "not empty", | ||
Description: "", | ||
Code: fosite.ErrInvalidRequest.Code, | ||
Debug: "", | ||
}, | ||
}, | ||
{ | ||
input: &RequestDeniedError{ | ||
Name: "", | ||
Description: "not empty", | ||
}, | ||
expect: &fosite.RFC6749Error{ | ||
Name: requestDeniedErrorName, | ||
Description: "not empty", | ||
Code: fosite.ErrInvalidRequest.Code, | ||
Debug: "", | ||
}, | ||
}, | ||
{ | ||
input: &RequestDeniedError{}, | ||
expect: &fosite.RFC6749Error{ | ||
Name: requestDeniedErrorName, | ||
Description: "", | ||
Hint: "", | ||
Code: fosite.ErrInvalidRequest.Code, | ||
Debug: "", | ||
}, | ||
}, | ||
} { | ||
t.Run(fmt.Sprintf("case=%d", k), func(t *testing.T) { | ||
require.EqualValues(t, tc.input.toRFCError(), tc.expect) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.