starting accounts #2
6 changed files with 12 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue