Explorar o código

Removed useless data

jnfrati %!s(int64=4) %!d(string=hai) anos
pai
achega
cf947bcb88

+ 1 - 6
internal/repository/gorm/allowlist_test.go

@@ -10,9 +10,6 @@ func TestUserEmailExistsOnAllowlist(t *testing.T) {
 	}
 
 	setupTestEnv(tester, t)
-	initUser(tester, t)
-	initProject(tester, t)
-	initOAuthIntegration(tester, t)
 	initAllowlist(tester, t)
 	defer cleanup(tester, t)
 
@@ -35,9 +32,7 @@ func TestUserDontExistsOnAllowList(t *testing.T) {
 	}
 
 	setupTestEnv(tester, t)
-	initUser(tester, t)
-	initProject(tester, t)
-	initOAuthIntegration(tester, t)
+	initAllowlist(tester, t)
 	defer cleanup(tester, t)
 
 	expected := false

+ 3 - 3
internal/repository/gorm/helpers_test.go

@@ -21,7 +21,7 @@ type tester struct {
 	repo           repository.Repository
 	key            *[32]byte
 	dbFileName     string
-	DB             *_gorm.DB
+	db             *_gorm.DB
 	initUsers      []*models.User
 	initProjects   []*models.Project
 	initGRs        []*models.GitRepo
@@ -97,7 +97,7 @@ func setupTestEnv(tester *tester, t *testing.T) {
 	}
 
 	tester.key = &key
-	tester.DB = db
+	tester.db = db
 	tester.repo = gorm.NewRepository(db, &key, nil)
 }
 
@@ -132,7 +132,7 @@ func initAllowlist(tester *tester, t *testing.T) {
 		UserEmail: "some@email.com",
 	}
 
-	tester.DB.Create(&allowedUser)
+	tester.db.Create(&allowedUser)
 
 	tester.initAllowlist = append(tester.initAllowlist, allowedUser)
 }

+ 1 - 9
internal/repository/test/allowlist.go

@@ -2,7 +2,6 @@ package test
 
 import (
 	"errors"
-	"fmt"
 
 	"github.com/porter-dev/porter/internal/models"
 	"github.com/porter-dev/porter/internal/repository"
@@ -17,11 +16,7 @@ type AllowlistRepository struct {
 // NewAllowlistRepository returns a AllowListRepository which uses
 // gorm.DB for querying the database.
 func NewAllowlistRepository(canQuery bool) repository.AllowlistRepository {
-	return &AllowlistRepository{canQuery, []*models.Allowlist{
-		{
-			UserEmail: "some@email.com",
-		},
-	}}
+	return &AllowlistRepository{canQuery, []*models.Allowlist{}}
 }
 
 func (repo *AllowlistRepository) UserEmailExists(email string) (bool, error) {
@@ -29,8 +24,6 @@ func (repo *AllowlistRepository) UserEmailExists(email string) (bool, error) {
 		return false, errors.New("cannot read database")
 	}
 
-	fmt.Println(len(repo.allowlist))
-
 	if len(repo.allowlist) == 0 {
 		return false, nil
 	}
@@ -38,7 +31,6 @@ func (repo *AllowlistRepository) UserEmailExists(email string) (bool, error) {
 	founded := false
 
 	for _, allowed := range repo.allowlist {
-		fmt.Println(allowed.UserEmail)
 		if allowed.UserEmail == email {
 			founded = true
 			break