starting accounts #2

Open
qpismont wants to merge 15 commits from accounts into main
6 changed files with 12 additions and 8 deletions
Showing only changes of commit 9d544c7e8a - Show all commits

View file

@ -3,7 +3,7 @@ when:
steps:
- name: build
image: golang:1.24-alpine
image: golang:1.24.1-alpine
commands:
- apk update
- apk add bash

View file

@ -3,7 +3,7 @@ when:
steps:
- name: lint
image: golang:1.24-alpine
image: golang:1.24.1-alpine
commands:
- apk update
- apk add bash curl jq

View file

@ -3,7 +3,7 @@ when:
steps:
- name: tests
image: golang:1.24-alpine
image: golang:1.24.1-alpine
environment:
TEST_DB_HOST: db
TEST_DB_PORT: 5432

View file

@ -9,7 +9,7 @@ import (
)
func TestRepository_Insert(t *testing.T) {
db := test.SetupTestDB(t, "../..")
db := test.SetupTestDB(t, "../../..")
defer db.Close()
repo := NewRepository(db)
@ -29,7 +29,7 @@ func TestRepository_Insert(t *testing.T) {
}
func TestRepository_FetchOneByUsername(t *testing.T) {
db := test.SetupTestDB(t, "../..")
db := test.SetupTestDB(t, "../../..")
defer db.Close()
repo := NewRepository(db)

View file

@ -32,6 +32,10 @@ func (s *Service) Login(login domain.AccountLogin) (*domain.AccountWithToken, *c
return nil, core.NewInternalServerError(err)
}
if account == nil {
return nil, domain.ErrAccountNotFound
}
ok, err := core.ComparePassword(login.Password, account.Password)
if err != nil {
return nil, domain.ErrBadPassword

View file

@ -19,9 +19,9 @@ func TestJWT_GenerateToken(t *testing.T) {
assert.NotEmpty(t, token)
claims, err := VerifyJWT(token)
if err != nil {
t.Fatalf("Failed to verify token: %v", err)
claims, jwtErr := VerifyJWT(token)
if jwtErr != nil {
t.Fatalf("Failed to verify token: %v", jwtErr)
}
assert.Equal(t, claims.AccountId, 1)