fix(fmt): formatting
This commit is contained in:
@@ -204,7 +204,7 @@ func (c *IdentityClient) VerifyPassword(ctx context.Context, email, password str
|
|||||||
|
|
||||||
resp, err := c.client.VerifyPassword(ctx, &identityv1.VerifyPasswordRequest{
|
resp, err := c.client.VerifyPassword(ctx, &identityv1.VerifyPasswordRequest{
|
||||||
Email: email,
|
Email: email,
|
||||||
Password: password,
|
Password: password,
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("verify password failed: %w", err)
|
return nil, fmt.Errorf("verify password failed: %w", err)
|
||||||
|
|||||||
@@ -182,4 +182,3 @@ func TestGateway_matchRoute(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -456,20 +456,20 @@ func (m *mockAuthClient) Logout(ctx context.Context, refreshToken string) error
|
|||||||
|
|
||||||
// mockIdentityClient implements services.IdentityServiceClient for testing.
|
// mockIdentityClient implements services.IdentityServiceClient for testing.
|
||||||
type mockIdentityClient struct {
|
type mockIdentityClient struct {
|
||||||
getUserResp *services.User
|
getUserResp *services.User
|
||||||
getUserErr error
|
getUserErr error
|
||||||
getUserByEmailResp *services.User
|
getUserByEmailResp *services.User
|
||||||
getUserByEmailErr error
|
getUserByEmailErr error
|
||||||
createUserResp *services.User
|
createUserResp *services.User
|
||||||
createUserErr error
|
createUserErr error
|
||||||
updateUserResp *services.User
|
updateUserResp *services.User
|
||||||
updateUserErr error
|
updateUserErr error
|
||||||
deleteUserErr error
|
deleteUserErr error
|
||||||
verifyEmailErr error
|
verifyEmailErr error
|
||||||
requestPasswordResetErr error
|
requestPasswordResetErr error
|
||||||
resetPasswordErr error
|
resetPasswordErr error
|
||||||
verifyPasswordResp *services.User
|
verifyPasswordResp *services.User
|
||||||
verifyPasswordErr error
|
verifyPasswordErr error
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockIdentityClient) GetUser(ctx context.Context, id string) (*services.User, error) {
|
func (m *mockIdentityClient) GetUser(ctx context.Context, id string) (*services.User, error) {
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ func TestGateway_handleLogin(t *testing.T) {
|
|||||||
name: "client error - unauthorized",
|
name: "client error - unauthorized",
|
||||||
requestBody: map[string]string{
|
requestBody: map[string]string{
|
||||||
"email": "test@example.com",
|
"email": "test@example.com",
|
||||||
"password": "wrongpassword",
|
"password": "wrongpassword",
|
||||||
},
|
},
|
||||||
clientErr: status.Error(codes.Unauthenticated, "invalid credentials"),
|
clientErr: status.Error(codes.Unauthenticated, "invalid credentials"),
|
||||||
expectedStatus: http.StatusUnauthorized,
|
expectedStatus: http.StatusUnauthorized,
|
||||||
@@ -70,7 +70,7 @@ func TestGateway_handleLogin(t *testing.T) {
|
|||||||
name: "client error - internal",
|
name: "client error - internal",
|
||||||
requestBody: map[string]string{
|
requestBody: map[string]string{
|
||||||
"email": "test@example.com",
|
"email": "test@example.com",
|
||||||
"password": "password123",
|
"password": "password123",
|
||||||
},
|
},
|
||||||
clientErr: status.Error(codes.Internal, "internal error"),
|
clientErr: status.Error(codes.Internal, "internal error"),
|
||||||
expectedStatus: http.StatusInternalServerError,
|
expectedStatus: http.StatusInternalServerError,
|
||||||
@@ -132,7 +132,7 @@ func TestGateway_handleRefreshToken(t *testing.T) {
|
|||||||
expectedStatus: http.StatusOK,
|
expectedStatus: http.StatusOK,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid request body",
|
name: "invalid request body",
|
||||||
requestBody: map[string]string{
|
requestBody: map[string]string{
|
||||||
// missing refresh_token
|
// missing refresh_token
|
||||||
},
|
},
|
||||||
@@ -200,7 +200,7 @@ func TestGateway_handleValidateToken(t *testing.T) {
|
|||||||
expectedStatus: http.StatusOK,
|
expectedStatus: http.StatusOK,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid request body",
|
name: "invalid request body",
|
||||||
requestBody: map[string]string{
|
requestBody: map[string]string{
|
||||||
// missing token
|
// missing token
|
||||||
},
|
},
|
||||||
@@ -261,7 +261,7 @@ func TestGateway_handleLogout(t *testing.T) {
|
|||||||
expectedStatus: http.StatusOK,
|
expectedStatus: http.StatusOK,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid request body",
|
name: "invalid request body",
|
||||||
requestBody: map[string]string{
|
requestBody: map[string]string{
|
||||||
// missing refresh_token
|
// missing refresh_token
|
||||||
},
|
},
|
||||||
@@ -316,11 +316,11 @@ func TestGateway_handleGetUser(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "successful get user",
|
name: "successful get user",
|
||||||
userID: "user-123",
|
userID: "user-123",
|
||||||
clientResp: &services.User{
|
clientResp: &services.User{
|
||||||
ID: "user-123",
|
ID: "user-123",
|
||||||
Email: "test@example.com",
|
Email: "test@example.com",
|
||||||
Username: "testuser",
|
Username: "testuser",
|
||||||
FirstName: "Test",
|
FirstName: "Test",
|
||||||
LastName: "User",
|
LastName: "User",
|
||||||
},
|
},
|
||||||
@@ -374,31 +374,31 @@ func TestGateway_handleCreateUser(t *testing.T) {
|
|||||||
name: "successful create",
|
name: "successful create",
|
||||||
requestBody: services.CreateUserRequest{
|
requestBody: services.CreateUserRequest{
|
||||||
Email: "test@example.com",
|
Email: "test@example.com",
|
||||||
Username: "testuser",
|
Username: "testuser",
|
||||||
Password: "password123",
|
Password: "password123",
|
||||||
FirstName: "Test",
|
FirstName: "Test",
|
||||||
LastName: "User",
|
LastName: "User",
|
||||||
},
|
},
|
||||||
clientResp: &services.User{
|
clientResp: &services.User{
|
||||||
ID: "user-123",
|
ID: "user-123",
|
||||||
Email: "test@example.com",
|
Email: "test@example.com",
|
||||||
Username: "testuser",
|
Username: "testuser",
|
||||||
FirstName: "Test",
|
FirstName: "Test",
|
||||||
LastName: "User",
|
LastName: "User",
|
||||||
},
|
},
|
||||||
expectedStatus: http.StatusCreated,
|
expectedStatus: http.StatusCreated,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid JSON",
|
name: "invalid JSON",
|
||||||
requestBody: "not a json object",
|
requestBody: "not a json object",
|
||||||
expectedStatus: http.StatusBadRequest,
|
expectedStatus: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "client error - already exists",
|
name: "client error - already exists",
|
||||||
requestBody: services.CreateUserRequest{
|
requestBody: services.CreateUserRequest{
|
||||||
Email: "existing@example.com",
|
Email: "existing@example.com",
|
||||||
Username: "existing",
|
Username: "existing",
|
||||||
Password: "password123",
|
Password: "password123",
|
||||||
},
|
},
|
||||||
clientErr: status.Error(codes.AlreadyExists, "user already exists"),
|
clientErr: status.Error(codes.AlreadyExists, "user already exists"),
|
||||||
expectedStatus: http.StatusConflict,
|
expectedStatus: http.StatusConflict,
|
||||||
@@ -517,4 +517,3 @@ func TestGateway_handleGRPCError(t *testing.T) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -239,4 +239,3 @@ func joinHash(parts []string) string {
|
|||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user