Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arxdsilva committed Nov 3, 2021
1 parent 7ac68d4 commit 0b115a9
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions services/authentication/authentication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ func Test_verifyV2Inputs_OK_refresh_token(t *testing.T) {
func TestV2Auth_OK(t *testing.T) {
ts := httptest.NewServer(
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, "/oauth/token", r.URL.Path)
require.Equal(t, "/authentication/v1.0/oauth/token", r.URL.Path)
require.Contains(t, r.Header["Content-Type"][0], "application/x-www-form-urlencoded")
fmt.Fprintf(w, `{"accessToken":"token","expiresIn":3600}`)
w.WriteHeader(http.StatusOK)
Expand All @@ -143,7 +143,7 @@ func TestV2Auth_RespNotOK(t *testing.T) {
ts := httptest.NewServer(
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method)
require.Equal(t, "/oauth/token", r.URL.Path)
require.Equal(t, "/authentication/v1.0/oauth/token", r.URL.Path)
require.Contains(t, r.Header["Content-Type"][0], "application/x-www-form-urlencoded")
w.WriteHeader(http.StatusBadRequest)
fmt.Fprintf(w, `{"error": {"code": "BadRequest","message": "Invalid grant type"}}`)
Expand All @@ -170,7 +170,7 @@ func Test_V2GetUserCode_OK(t *testing.T) {
ts := httptest.NewServer(
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method)
require.Equal(t, userCodeEndpoint, r.URL.Path)
require.Equal(t, "/authentication/v1.0"+userCodeEndpoint, r.URL.Path)
require.Equal(t, r.Header["Content-Type"][0], "application/x-www-form-urlencoded")
w.WriteHeader(http.StatusOK)
fmt.Fprintf(w, resp)
Expand All @@ -192,7 +192,7 @@ func Test_V2GetUserCode_ErrUnauthorized(t *testing.T) {
ts := httptest.NewServer(
http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
require.Equal(t, http.MethodPost, r.Method)
require.Equal(t, userCodeEndpoint, r.URL.Path)
require.Equal(t, "/authentication/v1.0"+userCodeEndpoint, r.URL.Path)
require.Equal(t, r.Header["Content-Type"][0], "application/x-www-form-urlencoded")
w.WriteHeader(http.StatusBadRequest)
fmt.Fprintf(w, `{"error": {"code": "BadRequest","message": "Invalid"}}`)
Expand Down

0 comments on commit 0b115a9

Please sign in to comment.