Skip to content

Commit

Permalink
tidy: formatting violations
Browse files Browse the repository at this point in the history
  • Loading branch information
hbomb79 committed Feb 29, 2024
1 parent 0772287 commit b2ba978
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 11 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ require (
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/labstack/gommon v0.4.2 // indirect
github.com/labstack/gommon v0.4.2
github.com/leodido/go-urn v1.2.4 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
Expand All @@ -65,7 +65,7 @@ require (
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.14.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.0.2 // indirect
gotest.tools/v3 v3.0.2
)

require (
Expand Down
4 changes: 2 additions & 2 deletions internal/api/controllers/auth/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ func (controller *AuthController) Login(ec echo.Context, request gen.LoginReques
user, err := controller.store.GetUserWithUsernameAndPassword([]byte(request.Body.Username), []byte(request.Body.Password))
if err != nil {
log.Warnf("Failed to authenticate due to error: %v\n", err)
return nil, gen.UnauthorizedError
return nil, gen.ErrAPIUnauthorized
}

authTokenCookie, refreshTokenCookie, err := controller.authProvider.GenerateTokenCookies(user.ID)
if err != nil {
log.Warnf("Failed to authenticate due to error: %v\n", err)
return nil, gen.UnauthorizedError
return nil, gen.ErrAPIUnauthorized
}
return LoginResponse{User: userToDto(user), AuthToken: *authTokenCookie, RefreshToken: *refreshTokenCookie}, nil
}
Expand Down
6 changes: 1 addition & 5 deletions internal/api/controllers/auth/controller_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@ import (
"github.com/stretchr/testify/assert"
)

const (
loginCookiesCount = 2
)

var ctx = context.Background() // TODO: get these from env.
var ctx = context.Background()

/*
This package performs HTTP REST API testing against
Expand Down
2 changes: 1 addition & 1 deletion internal/api/gen/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func (err APIError) Error() string {
return fmt.Sprintf("api error: %s", err.Message)
}

var UnauthorizedError APIError = APIError{Status: 401}
var ErrAPIUnauthorized APIError = APIError{Status: 401}

// GetHTTPErrorHandler returns an echo HTTP error handler
// which understands how to interpret APIError. If an error is
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewClientWithCredentials(t *testing.T, username string, password string) (T
return TestUser{User: *resp.JSON200, Password: password}, authClient
}

// newClientWithUser creates a new user using a default API client,
// NewClientWithRandomUser creates a new user using a default API client,
// and returns back a new client which has request editors to automatically
// inject the new users auth tokens in to requests made with the client.
// TODO: add cleanup task to testing context to delete user (t.Cleanup()).
Expand Down

0 comments on commit b2ba978

Please sign in to comment.