Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dadrus committed Dec 17, 2024
1 parent e2f06b8 commit 26834f4
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,3 +214,13 @@ func TestAnonymousAuthenticatorIsFallbackOnErrorAllowed(t *testing.T) {
// THEN
require.False(t, isAllowed)
}

func TestAnonymousAuthenticatorIsInsecure(t *testing.T) {
t.Parallel()

// GIVEN
auth := anonymousAuthenticator{}

// WHEN & THEN
require.True(t, auth.IsInsecure())
}
Original file line number Diff line number Diff line change
Expand Up @@ -538,3 +538,13 @@ password: bar`))
})
}
}

func TestBasicAuthAuthenticatorIsInsecure(t *testing.T) {
t.Parallel()

// GIVEN
auth := basicAuthAuthenticator{}

// WHEN & THEN
require.False(t, auth.IsInsecure())
}
Original file line number Diff line number Diff line change
Expand Up @@ -1479,3 +1479,13 @@ func TestGenericAuthenticatorGetCacheTTL(t *testing.T) {
})
}
}

func TestGenericAuthenticatorIsInsecure(t *testing.T) {
t.Parallel()

// GIVEN
auth := genericAuthenticator{}

// WHEN & THEN
require.False(t, auth.IsInsecure())
}
10 changes: 10 additions & 0 deletions internal/rules/mechanisms/authenticators/jwt_authenticator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2584,3 +2584,13 @@ func TestJwtAuthenticatorGetCacheTTL(t *testing.T) {
})
}
}

func TestJwtAuthenticatorIsInsecure(t *testing.T) {
t.Parallel()

// GIVEN
auth := jwtAuthenticator{}

// WHEN & THEN
require.False(t, auth.IsInsecure())
}
Original file line number Diff line number Diff line change
Expand Up @@ -1893,3 +1893,13 @@ func TestCacheTTLCalculation(t *testing.T) {
})
}
}

func TestOauth2IntrospectionAuthenticatorIsInsecure(t *testing.T) {
t.Parallel()

// GIVEN
auth := oauth2IntrospectionAuthenticator{}

// WHEN & THEN
require.False(t, auth.IsInsecure())
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,13 @@ func TestUnauthorizedAuthenticatorIsFallbackOnErrorAllowed(t *testing.T) {
require.False(t, isAllowed)
require.Equal(t, "unauth", auth.ID())
}

func TestUnauthorizedAuthenticatorIsInsecure(t *testing.T) {
t.Parallel()

// GIVEN
auth := unauthorizedAuthenticator{}

// WHEN & THEN
require.False(t, auth.IsInsecure())
}

0 comments on commit 26834f4

Please sign in to comment.