fix: fist integration test #181
All checks were successful
Build Docker Image / Explore-Gitea-Actions (push) Successful in 47s
Build and Push Docker Image / Explore-Gitea-Actions (push) Successful in 52s

This commit was merged in pull request #189.
This commit is contained in:
2024-10-02 23:13:31 +02:00
parent 33380e2124
commit f2a98e5f49
9 changed files with 181 additions and 46 deletions

View File

@@ -18,14 +18,14 @@ type User struct {
Id uuid.UUID
Email string
EmailVerified bool
EmailVerifiedAt time.Time
EmailVerifiedAt *time.Time
IsAdmin bool
Password []byte
Salt []byte
CreateAt time.Time
}
func NewUser(id uuid.UUID, email string, emailVerified bool, emailVerifiedAt time.Time, isAdmin bool, password []byte, salt []byte, createAt time.Time) *User {
func NewUser(id uuid.UUID, email string, emailVerified bool, emailVerifiedAt *time.Time, isAdmin bool, password []byte, salt []byte, createAt time.Time) *User {
return &User{
Id: id,
Email: email,
@@ -54,7 +54,7 @@ func (db DbAuthSqlite) GetUser(email string) (*User, error) {
var (
userId uuid.UUID
emailVerified bool
emailVerifiedAt time.Time
emailVerifiedAt *time.Time
isAdmin bool
password []byte
salt []byte

View File

@@ -16,7 +16,10 @@ func setupDb(t *testing.T) *sql.DB {
t.Fatalf("Error opening database: %v", err)
}
utils.MustRunMigrations(db, "../")
err = utils.RunMigrations(db, "../")
if err != nil {
t.Fatalf("Error running migrations: %v", err)
}
return db
}
@@ -46,7 +49,7 @@ func TestGetUser(t *testing.T) {
verifiedAt := time.Date(2020, 1, 5, 13, 0, 0, 0, time.UTC)
createAt := time.Date(2020, 1, 5, 12, 0, 0, 0, time.UTC)
user := NewUser(uuid.New(), "some@email.de", true, verifiedAt, false, []byte("somePass"), []byte("someSalt"), createAt)
user := NewUser(uuid.New(), "some@email.de", true, &verifiedAt, false, []byte("somePass"), []byte("someSalt"), createAt)
_, err := db.Exec(`
INSERT INTO user (user_uuid, email, email_verified, email_verified_at, is_admin, password, salt, created_at)