Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
livio-a committed Dec 5, 2023
1 parent a899907 commit 3dc601f
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions pkg/authorization/check_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"testing"

"github.com/stretchr/testify/assert"
"golang.org/x/exp/slog"
)

func TestAuthorizer_CheckAuthorization(t *testing.T) {
Expand All @@ -24,7 +25,8 @@ func TestAuthorizer_CheckAuthorization(t *testing.T) {
{
name: "empty token, unauthorized error",
a: Authorizer[*testCtx]{
&testVerifier[*testCtx]{},
verifier: &testVerifier[*testCtx]{},
logger: slog.Default(),
},
args: args{
ctx: context.Background(),
Expand All @@ -37,7 +39,8 @@ func TestAuthorizer_CheckAuthorization(t *testing.T) {
{
name: "unauthorized, unauthorized error",
a: Authorizer[*testCtx]{
&testVerifier[*testCtx]{},
verifier: &testVerifier[*testCtx]{},
logger: slog.Default(),
},
args: args{
ctx: context.Background(),
Expand All @@ -50,11 +53,12 @@ func TestAuthorizer_CheckAuthorization(t *testing.T) {
{
name: "missing role, permissiondenied error",
a: Authorizer[*testCtx]{
&testVerifier[*testCtx]{
verifier: &testVerifier[*testCtx]{
ctx: &testCtx{
isAuthorized: true,
},
},
logger: slog.Default(),
},
args: args{
ctx: context.Background(),
Expand All @@ -67,11 +71,12 @@ func TestAuthorizer_CheckAuthorization(t *testing.T) {
{
name: "authorized",
a: Authorizer[*testCtx]{
&testVerifier[*testCtx]{
verifier: &testVerifier[*testCtx]{
ctx: &testCtx{
isAuthorized: true,
},
},
logger: slog.Default(),
},
args: args{
ctx: context.Background(),
Expand All @@ -84,12 +89,13 @@ func TestAuthorizer_CheckAuthorization(t *testing.T) {
{
name: "authorized with role",
a: Authorizer[*testCtx]{
&testVerifier[*testCtx]{
verifier: &testVerifier[*testCtx]{
ctx: &testCtx{
isAuthorized: true,
isGrantedRole: true,
},
},
logger: slog.Default(),
},
args: args{
ctx: context.Background(),
Expand Down

0 comments on commit 3dc601f

Please sign in to comment.