test(oidc): fix disabled tests (#3173)

pull/3175/head
James Elliott 2022-04-12 13:02:12 +10:00 committed by GitHub
parent 3917ef9dcf
commit 85a88de24d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 8 deletions

View File

@ -1,6 +1,15 @@
package oidc package oidc
/* import (
"context"
"testing"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/authelia/authelia/v4/internal/authorization"
"github.com/authelia/authelia/v4/internal/configuration/schema"
)
func TestOpenIDConnectStore_GetClientPolicy(t *testing.T) { func TestOpenIDConnectStore_GetClientPolicy(t *testing.T) {
s := NewOpenIDConnectStore(&schema.OpenIDConnectConfiguration{ s := NewOpenIDConnectStore(&schema.OpenIDConnectConfiguration{
@ -21,7 +30,7 @@ func TestOpenIDConnectStore_GetClientPolicy(t *testing.T) {
Secret: "mysecret", Secret: "mysecret",
}, },
}, },
}) }, nil)
policyOne := s.GetClientPolicy("myclient") policyOne := s.GetClientPolicy("myclient")
assert.Equal(t, authorization.OneFactor, policyOne) assert.Equal(t, authorization.OneFactor, policyOne)
@ -45,7 +54,7 @@ func TestOpenIDConnectStore_GetInternalClient(t *testing.T) {
Secret: "mysecret", Secret: "mysecret",
}, },
}, },
}) }, nil)
client, err := s.GetClient(context.Background(), "myinvalidclient") client, err := s.GetClient(context.Background(), "myinvalidclient")
assert.EqualError(t, err, "not_found") assert.EqualError(t, err, "not_found")
@ -69,7 +78,7 @@ func TestOpenIDConnectStore_GetInternalClient_ValidClient(t *testing.T) {
s := NewOpenIDConnectStore(&schema.OpenIDConnectConfiguration{ s := NewOpenIDConnectStore(&schema.OpenIDConnectConfiguration{
IssuerPrivateKey: exampleIssuerPrivateKey, IssuerPrivateKey: exampleIssuerPrivateKey,
Clients: []schema.OpenIDConnectClientConfiguration{c1}, Clients: []schema.OpenIDConnectClientConfiguration{c1},
}) }, nil)
client, err := s.GetFullClient(c1.ID) client, err := s.GetFullClient(c1.ID)
require.NoError(t, err) require.NoError(t, err)
@ -96,7 +105,7 @@ func TestOpenIDConnectStore_GetInternalClient_InvalidClient(t *testing.T) {
s := NewOpenIDConnectStore(&schema.OpenIDConnectConfiguration{ s := NewOpenIDConnectStore(&schema.OpenIDConnectConfiguration{
IssuerPrivateKey: exampleIssuerPrivateKey, IssuerPrivateKey: exampleIssuerPrivateKey,
Clients: []schema.OpenIDConnectClientConfiguration{c1}, Clients: []schema.OpenIDConnectClientConfiguration{c1},
}) }, nil)
client, err := s.GetFullClient("another-client") client, err := s.GetFullClient("another-client")
assert.Nil(t, client) assert.Nil(t, client)
@ -115,12 +124,11 @@ func TestOpenIDConnectStore_IsValidClientID(t *testing.T) {
Secret: "mysecret", Secret: "mysecret",
}, },
}, },
}) }, nil)
validClient := s.IsValidClientID("myclient") validClient := s.IsValidClientID("myclient")
invalidClient := s.IsValidClientID("myinvalidclient") invalidClient := s.IsValidClientID("myinvalidclient")
assert.True(t, validClient) assert.True(t, validClient)
assert.False(t, invalidClient) assert.False(t, invalidClient)
}. }
*/