diff --git a/internal/federationdomain/federationdomainproviders/federation_domain_issuer_test.go b/internal/federationdomain/federationdomainproviders/federation_domain_issuer_test.go index cd4c97fb..34125d74 100644 --- a/internal/federationdomain/federationdomainproviders/federation_domain_issuer_test.go +++ b/internal/federationdomain/federationdomainproviders/federation_domain_issuer_test.go @@ -4,6 +4,7 @@ package federationdomainproviders import ( + "fmt" "testing" "github.com/stretchr/testify/require" @@ -105,3 +106,34 @@ func TestFederationDomainIssuerValidations(t *testing.T) { }) } } + +func TestFederationDomainGetters(t *testing.T) { + const issuerHost = "some-issuer.com" + const issuerPath = "/some/path" + issuerURLString := fmt.Sprintf("https://%s%s", issuerHost, issuerPath) + + provider1 := &FederationDomainIdentityProvider{ + DisplayName: "test-name-1", + UID: "test-uid-1", + } + provider2 := &FederationDomainIdentityProvider{ + DisplayName: "test-name-2", + UID: "test-uid-2", + } + + fdi, err := NewFederationDomainIssuer(issuerURLString, []*FederationDomainIdentityProvider{provider1, provider2}) + require.NoError(t, err) + require.Equal(t, issuerURLString, fdi.Issuer()) + require.Equal(t, issuerHost, fdi.IssuerHost()) + require.Equal(t, issuerPath, fdi.IssuerPath()) + require.Equal(t, []*FederationDomainIdentityProvider{provider1, provider2}, fdi.IdentityProviders()) + require.Nil(t, fdi.DefaultIdentityProvider()) + + fdi, err = NewFederationDomainIssuerWithDefaultIDP(issuerURLString, provider1) + require.NoError(t, err) + require.Equal(t, issuerURLString, fdi.Issuer()) + require.Equal(t, issuerHost, fdi.IssuerHost()) + require.Equal(t, issuerPath, fdi.IssuerPath()) + require.Equal(t, []*FederationDomainIdentityProvider{provider1}, fdi.IdentityProviders()) + require.Equal(t, provider1, fdi.DefaultIdentityProvider()) +}