-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix linting added revive config file
- Loading branch information
Showing
24 changed files
with
149 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,21 +12,21 @@ import ( | |
|
||
type mockService struct{} | ||
|
||
func (m mockService) Login(ctx context.Context, email, password string) (string, error) { | ||
func (mockService) Login(_ context.Context, email, password string) (string, error) { | ||
if email == "[email protected]" && password == "pass" { | ||
return "token-100", nil | ||
} | ||
return "", errors.Unauthorized("") | ||
} | ||
|
||
func (m mockService) Register(ctx context.Context, email, password string) error { | ||
func (mockService) Register(_ context.Context, email, password string) error { | ||
if email == "[email protected]" && password == "pass" { | ||
return nil | ||
} | ||
return errors.Unauthorized("") | ||
} | ||
|
||
func (m mockService) Verify(ctx context.Context, id, expires string) error { | ||
func (mockService) Verify(_ context.Context, _, _ string) error { | ||
return nil | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,5 +86,4 @@ func TestRepository(t *testing.T) { | |
}) | ||
|
||
assert.Nil(t, err) | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ func Test_service_Authenticate(t *testing.T) { | |
pass, _ := bcrypt.GenerateFromPassword([]byte("pass"), bcrypt.MinCost) | ||
repo := &mockRepository{ | ||
items: []entity.User{ | ||
{ID: "100", Email: "[email protected]", Password: string(pass), CreatedAt: time.Now(), UpdatedAt: time.Now(), IsActive: true}, | ||
{ID: "100", Email: "[email protected]", Password: string(pass), CreatedAt: time.Now(), UpdatedAt: time.Now(), IsActive: true, EmailVerified: true}, | ||
}, | ||
keys: []struct { | ||
Key string | ||
|
@@ -44,12 +44,12 @@ func Test_service_Authenticate(t *testing.T) { | |
assert.NotEmpty(t, token) | ||
} | ||
|
||
func Test_service_authenticate(t *testing.T) { | ||
func Test_service_authenticate_function(t *testing.T) { | ||
logger, _ := log.NewForTest() | ||
pass, _ := bcrypt.GenerateFromPassword([]byte("pass"), bcrypt.MinCost) | ||
repo := &mockRepository{ | ||
items: []entity.User{ | ||
{ID: "100", Email: "[email protected]", Password: string(pass), CreatedAt: time.Now(), UpdatedAt: time.Now(), IsActive: true}, | ||
{ID: "100", Email: "[email protected]", Password: string(pass), CreatedAt: time.Now(), UpdatedAt: time.Now(), IsActive: true, EmailVerified: true}, | ||
}, | ||
keys: []struct { | ||
Key string | ||
|
@@ -89,7 +89,7 @@ func Test_service_GenerateJWT(t *testing.T) { | |
} | ||
} | ||
|
||
func (m mockRepository) GetUserByEmail(ctx context.Context, email string) (entity.User, error) { | ||
func (m mockRepository) GetUserByEmail(_ context.Context, email string) (entity.User, error) { | ||
for _, item := range m.items { | ||
if item.Email == email { | ||
return item, nil | ||
|
@@ -98,7 +98,7 @@ func (m mockRepository) GetUserByEmail(ctx context.Context, email string) (entit | |
return entity.User{}, sql.ErrNoRows | ||
} | ||
|
||
func (m mockRepository) GetUserByAPIKey(ctx context.Context, apiKey string) (entity.User, error) { | ||
func (m mockRepository) GetUserByAPIKey(_ context.Context, apiKey string) (entity.User, error) { | ||
var userID string | ||
for _, key := range m.keys { | ||
if key.UserID == apiKey { | ||
|
@@ -113,22 +113,22 @@ func (m mockRepository) GetUserByAPIKey(ctx context.Context, apiKey string) (ent | |
return entity.User{}, sql.ErrNoRows | ||
} | ||
|
||
func (m mockRepository) Register(ctx context.Context, user entity.User) error { | ||
func (m mockRepository) Register(_ context.Context, user entity.User) error { | ||
if user.ID == "error" { | ||
return errors.Unauthorized("") | ||
} | ||
m.items = append(m.items, user) | ||
return nil | ||
} | ||
|
||
func (m mockRepository) CreateEmailVerification(ctx context.Context, verification entity.EmailVerification) error { | ||
func (mockRepository) CreateEmailVerification(_ context.Context, verification entity.EmailVerification) error { | ||
if verification.UserID == "duplicate" { | ||
return errors.BadRequest("The user you're trying to register already exists") | ||
} | ||
return nil | ||
} | ||
|
||
func (m mockRepository) GetEmailVerification(ctx context.Context, userID, token string) (entity.EmailVerification, error) { | ||
func (m mockRepository) GetEmailVerification(_ context.Context, userID, _ string) (entity.EmailVerification, error) { | ||
for _, item := range m.items { | ||
if item.ID == userID { | ||
return entity.EmailVerification{UserID: userID}, nil | ||
|
@@ -137,6 +137,6 @@ func (m mockRepository) GetEmailVerification(ctx context.Context, userID, token | |
return entity.EmailVerification{}, sql.ErrNoRows | ||
} | ||
|
||
func (m mockRepository) VerifyEmail(ctx context.Context, validation VerifyRequest) error { | ||
func (mockRepository) VerifyEmail(_ context.Context, _ VerifyRequest) error { | ||
return nil | ||
} |
Oops, something went wrong.