Skip to content

Commit

Permalink
fix test and deprecated messages
Browse files Browse the repository at this point in the history
  • Loading branch information
Asaduzzaman Pavel committed Oct 16, 2018
1 parent 5babe03 commit 36fca93
Show file tree
Hide file tree
Showing 41 changed files with 391 additions and 177 deletions.
2 changes: 1 addition & 1 deletion api/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/go-chi/chi"
"github.com/netlify/gotrue/models"
"github.com/netlify/gotrue/storage"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
)

type adminUserParams struct {
Expand Down
2 changes: 1 addition & 1 deletion api/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
jwt "github.com/dgrijalva/jwt-go"
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
Expand Down
2 changes: 1 addition & 1 deletion api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/netlify/gotrue/storage"
"github.com/netlify/netlify-commons/graceful"
"github.com/rs/cors"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/sebest/xff"
"github.com/sirupsen/logrus"
)
Expand Down
2 changes: 1 addition & 1 deletion api/api_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/netlify/gotrue/models"
"github.com/netlify/gotrue/storage"
"github.com/netlify/gotrue/storage/test"
"github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/require"
)

Expand Down
2 changes: 1 addition & 1 deletion api/audit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
jwt "github.com/dgrijalva/jwt-go"
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
Expand Down
2 changes: 1 addition & 1 deletion api/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
jwt "github.com/dgrijalva/jwt-go"
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
)

type contextKey string
Expand Down
4 changes: 2 additions & 2 deletions api/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (e *OAuthError) WithInternalError(err error) *OAuthError {

// WithInternalMessage adds internal message information to the error
func (e *OAuthError) WithInternalMessage(fmtString string, args ...interface{}) *OAuthError {
e.InternalMessage = fmt.Sprintf(fmtString, args)
e.InternalMessage = fmt.Sprintf(fmtString, args...)
return e
}

Expand Down Expand Up @@ -111,7 +111,7 @@ func (e *HTTPError) WithInternalError(err error) *HTTPError {

// WithInternalMessage adds internal message information to the error
func (e *HTTPError) WithInternalMessage(fmtString string, args ...interface{}) *HTTPError {
e.InternalMessage = fmt.Sprintf(fmtString, args)
e.InternalMessage = fmt.Sprintf(fmtString, args...)
return e
}

Expand Down
2 changes: 1 addition & 1 deletion api/external.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/netlify/gotrue/api/provider"
"github.com/netlify/gotrue/models"
"github.com/netlify/gotrue/storage"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/sirupsen/logrus"
)

Expand Down
2 changes: 1 addition & 1 deletion api/external_saml_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"github.com/netlify/gotrue/models"
"github.com/russellhaering/gosaml2/types"
dsig "github.com/russellhaering/goxmldsig"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
Expand Down
2 changes: 1 addition & 1 deletion api/external_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
jwt "github.com/dgrijalva/jwt-go"
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
)
Expand Down
2 changes: 1 addition & 1 deletion api/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/netlify/gotrue/models"
"github.com/netlify/gotrue/storage"
"github.com/pkg/errors"
"github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
)

func addRequestID(globalConfig *conf.GlobalConfiguration) middlewareHandler {
Expand Down
2 changes: 1 addition & 1 deletion api/hook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
"github.com/netlify/gotrue/storage/test"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down
4 changes: 2 additions & 2 deletions api/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

jwt "github.com/dgrijalva/jwt-go"
"github.com/pkg/errors"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/sirupsen/logrus"

"github.com/netlify/gotrue/conf"
Expand Down Expand Up @@ -103,7 +103,7 @@ func (w *Webhook) trigger() (io.ReadCloser, error) {
// timed out - try again?
if i == w.Retries-1 {
closeBody(rsp)
return nil, httpError(http.StatusGatewayTimeout, "Failed to perform webhook in time frame (%d seconds)", timeout.Seconds())
return nil, httpError(http.StatusGatewayTimeout, "Failed to perform webhook in time frame (%v seconds)", timeout.Seconds())
}
hooklog.Info("Request timed out")
continue
Expand Down
2 changes: 1 addition & 1 deletion api/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
"github.com/pkg/errors"
"github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
)

func (a *API) loadInstance(w http.ResponseWriter, r *http.Request) (context.Context, error) {
Expand Down
2 changes: 1 addition & 1 deletion api/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http/httptest"
"testing"

"github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"

"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
Expand Down
2 changes: 1 addition & 1 deletion api/invite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
jwt "github.com/dgrijalva/jwt-go"
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
Expand Down
2 changes: 1 addition & 1 deletion api/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (

jwt "github.com/dgrijalva/jwt-go"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion api/provider/saml.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
saml2 "github.com/russellhaering/gosaml2"
"github.com/russellhaering/gosaml2/types"
dsig "github.com/russellhaering/goxmldsig"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"golang.org/x/oauth2"
)

Expand Down
2 changes: 1 addition & 1 deletion api/recover_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
Expand Down
2 changes: 1 addition & 1 deletion api/signup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import (
jwt "github.com/dgrijalva/jwt-go"
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
Expand Down
4 changes: 2 additions & 2 deletions api/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (a *API) ResourceOwnerPasswordGrant(ctx context.Context, w http.ResponseWri

if cookie != "" && config.Cookie.Duration > 0 {
if terr = a.setCookieToken(config, token.Token, cookie == useSessionCookie, w); terr != nil {
return internalServerError("Failed to set JWT cookie", terr)
return internalServerError("Failed to set JWT cookie. %s", terr)
}
}
return nil
Expand Down Expand Up @@ -145,7 +145,7 @@ func (a *API) RefreshTokenGrant(ctx context.Context, w http.ResponseWriter, r *h

if cookie != "" && config.Cookie.Duration > 0 {
if terr = a.setCookieToken(config, tokenString, cookie == useSessionCookie, w); terr != nil {
return internalServerError("Failed to set JWT cookie", terr)
return internalServerError("Failed to set JWT cookie. %s", terr)
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion api/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/netlify/gotrue/models"
"github.com/netlify/gotrue/storage"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
)

// UserUpdateParams parameters for updating a user
Expand Down
2 changes: 1 addition & 1 deletion api/user_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (

"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
Expand Down
2 changes: 1 addition & 1 deletion api/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (a *API) Verify(w http.ResponseWriter, r *http.Request) error {

if cookie != "" && config.Cookie.Duration > 0 {
if terr = a.setCookieToken(config, token.Token, cookie == useSessionCookie, w); terr != nil {
return internalServerError("Failed to set JWT cookie", terr)
return internalServerError("Failed to set JWT cookie. %s", terr)
}
}
return nil
Expand Down
2 changes: 1 addition & 1 deletion api/verify_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"
Expand Down
2 changes: 1 addition & 1 deletion cmd/admin_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/models"
"github.com/netlify/gotrue/storage"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/serve_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"github.com/netlify/gotrue/api"
"github.com/netlify/gotrue/conf"
"github.com/netlify/gotrue/storage"
uuid "github.com/satori/go.uuid"
"github.com/gobuffalo/uuid"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)
Expand Down
14 changes: 7 additions & 7 deletions example.env
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
GOTRUE_JWT_SECRET="CHANGE-THIS! VERY IMPORTANT!"
GOTRUE_JWT_SECRET="m1HIQZxYScoiKkTp1DTv45WFiyt7r92p"
GOTRUE_JWT_EXP=3600
GOTRUE_JWT_AUD=api.netlify.com
GOTRUE_DB_DRIVER=mysql
DATABASE_URL="root@tcp(127.0.0.1:3306)/gotrue_development?parseTime=true"
DATABASE_URL="root@tcp(127.0.0.1:3306)/gotrue_development?parseTime=true&multiStatements=true"
GOTRUE_API_HOST=localhost
PORT=9999
GOTRUE_SITE_URL=https://my-jam-site.example.com
GOTRUE_SMTP_HOST=smtp.mandrillapp.com
GOTRUE_SMTP_HOST=smtp.sendgrid.net
GOTRUE_SMTP_PORT=587
GOTRUE_SMTP_USER=[email protected]
GOTRUE_SMTP_PASS=super-secret-password
GOTRUE_SMTP_ADMIN_EMAIL=admin@example.com
GOTRUE_SMTP_USER=apikey
GOTRUE_SMTP_PASS=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
GOTRUE_SMTP_ADMIN_EMAIL=noreply@coinread.com
GOTRUE_MAILER_SUBJECTS_CONFIRMATION="Welcome to GoTrue!"
GOTRUE_MAILER_SUBJECTS_RECOVERY="Reset your GoTrue password!"
GOTRUE_EXTERNAL_GOOGLE_REDIRECT_URI=http://localhost:9999/callback
GOTRUE_LOG_LEVEL=DEBUG
GOTRUE_OPERATOR_TOKEN=super-secret-operator-token
GOTRUE_OPERATOR_TOKEN=NZ4qIdsRXuuIAEYiUPGsQ6lx3av7cCdX
Loading

0 comments on commit 36fca93

Please sign in to comment.