Ver Fonte

fix test case

Mohammed Nafees há 3 anos atrás
pai
commit
ec3c9fd18d
1 ficheiros alterados com 11 adições e 4 exclusões
  1. 11 4
      internal/repository/test/saml.go

+ 11 - 4
internal/repository/test/saml.go

@@ -1,8 +1,11 @@
 package test
 
 import (
+	"strings"
+
 	"github.com/porter-dev/porter/internal/models/saml"
 	"github.com/porter-dev/porter/internal/repository"
+	"gorm.io/gorm"
 )
 
 // SAMLIntegrationRepository implements repository.SAMLIntegrationRepository
@@ -20,11 +23,15 @@ func NewSAMLIntegrationRepository(canQuery bool) repository.SAMLIntegrationRepos
 }
 
 func (repo *SAMLIntegrationRepository) ValidateSAMLIntegration(domain string) (*saml.SAMLIntegration, error) {
-	integ := &saml.SAMLIntegration{}
-
-	// TODO: fix test query
+	for _, integ := range repo.integrations {
+		for _, d := range strings.Split(integ.Domains, ",") {
+			if d == domain {
+				return integ, nil
+			}
+		}
+	}
 
-	return integ, nil
+	return nil, gorm.ErrRecordNotFound
 }
 
 func (repo *SAMLIntegrationRepository) CreateSAMLIntegration(integ *saml.SAMLIntegration) (*saml.SAMLIntegration, error) {