Tests: Add unit tests
This commit is contained in:
parent
dfe7142c8f
commit
54c3ac9b6a
2 changed files with 26 additions and 0 deletions
|
@ -46,6 +46,7 @@ func TestMethodType_NotEqual(t *testing.T) {
|
|||
func TestMethod(t *testing.T) {
|
||||
assert.Equal(t, MethodDefault, Method("default"))
|
||||
assert.Equal(t, MethodDefault, Method(""))
|
||||
assert.Equal(t, MethodDefault, Method("access_token"))
|
||||
assert.Equal(t, MethodOAuth2, Method("oauth2"))
|
||||
assert.Equal(t, MethodOIDC, Method("oidc"))
|
||||
assert.Equal(t, MethodOIDC, Method("sso"))
|
||||
|
@ -53,3 +54,13 @@ func TestMethod(t *testing.T) {
|
|||
assert.Equal(t, MethodTOTP, Method("totp"))
|
||||
assert.Equal(t, MethodTOTP, Method("TOTP/2FA"))
|
||||
}
|
||||
|
||||
func TestMethodType_IsUnknown(t *testing.T) {
|
||||
assert.True(t, MethodUnknown.IsUnknown())
|
||||
assert.False(t, MethodTOTP.IsUnknown())
|
||||
}
|
||||
|
||||
func TestMethodType_IsSession(t *testing.T) {
|
||||
assert.True(t, MethodSession.IsSession())
|
||||
assert.False(t, MethodTOTP.IsSession())
|
||||
}
|
||||
|
|
|
@ -13,6 +13,8 @@ func TestProviderType_String(t *testing.T) {
|
|||
assert.Equal(t, "local", ProviderLocal.String())
|
||||
assert.Equal(t, "ldap", ProviderLDAP.String())
|
||||
assert.Equal(t, "link", ProviderLink.String())
|
||||
assert.Equal(t, "access_token", ProviderAccessToken.String())
|
||||
assert.Equal(t, "client_credentials", ProviderClientCredentials.String())
|
||||
}
|
||||
|
||||
func TestProviderType_IsRemote(t *testing.T) {
|
||||
|
@ -65,6 +67,8 @@ func TestProviderType_Pretty(t *testing.T) {
|
|||
assert.Equal(t, "Default", ProviderDefault.Pretty())
|
||||
assert.Equal(t, "Default", ProviderUnknown.Pretty())
|
||||
assert.Equal(t, "Client", ProviderClient.Pretty())
|
||||
assert.Equal(t, "Access Token", ProviderAccessToken.Pretty())
|
||||
assert.Equal(t, "Client Credentials", ProviderClientCredentials.Pretty())
|
||||
}
|
||||
|
||||
func TestProvider(t *testing.T) {
|
||||
|
@ -73,4 +77,15 @@ func TestProvider(t *testing.T) {
|
|||
assert.Equal(t, ProviderDefault, Provider(""))
|
||||
assert.Equal(t, ProviderLink, Provider("url"))
|
||||
assert.Equal(t, ProviderDefault, Provider("default"))
|
||||
assert.Equal(t, ProviderClientCredentials, Provider("oauth2"))
|
||||
}
|
||||
|
||||
func TestProviderType_IsUnknown(t *testing.T) {
|
||||
assert.True(t, ProviderUnknown.IsUnknown())
|
||||
assert.False(t, ProviderLocal.IsUnknown())
|
||||
}
|
||||
|
||||
func TestProviderType_IsApplication(t *testing.T) {
|
||||
assert.True(t, ProviderApplication.IsApplication())
|
||||
assert.False(t, ProviderLocal.IsApplication())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue