-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3e04ba0
commit 7f6cee1
Showing
4 changed files
with
10 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,7 +23,7 @@ func TestDeleteAccountOauth(t *testing.T) { | |
return http.ErrUseLastResponse | ||
} | ||
|
||
t.Run("delete social account", func(t *testing.T) { | ||
t.Run("success", func(t *testing.T) { | ||
account, err := app.AccountStore.Create("[email protected]", []byte("password")) | ||
require.NoError(t, err) | ||
|
||
|
@@ -40,15 +40,15 @@ func TestDeleteAccountOauth(t *testing.T) { | |
require.Equal(t, []byte{}, test.ReadBody(res)) | ||
}) | ||
|
||
t.Run("return not found when user does not exists", func(t *testing.T) { | ||
t.Run("user does not exist", func(t *testing.T) { | ||
payload := map[string]interface{}{"oauth_providers": []string{"test"}} | ||
res, err := client.DeleteJSON("/accounts/9999/oauth", payload) | ||
require.NoError(t, err) | ||
|
||
require.Equal(t, http.StatusNotFound, res.StatusCode) | ||
}) | ||
|
||
t.Run("return unprocessable entity when user requires a new password", func(t *testing.T) { | ||
t.Run("requires new password", func(t *testing.T) { | ||
expected := "{\"errors\":[{\"field\":\"password\",\"message\":\"NEW_PASSWORD_REQUIRED\"}]}" | ||
account, err := app.AccountStore.Create("[email protected]", []byte("password")) | ||
require.NoError(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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,15 +32,15 @@ func TestDeleteOauthAccount(t *testing.T) { | |
return http.ErrUseLastResponse | ||
} | ||
|
||
t.Run("unanthorized", func(t *testing.T) { | ||
t.Run("unauthorized", func(t *testing.T) { | ||
res, err := client.Delete("/oauth/test") | ||
require.NoError(t, err) | ||
|
||
require.Equal(t, http.StatusUnauthorized, res.StatusCode) | ||
require.Equal(t, []byte{}, test.ReadBody(res)) | ||
}) | ||
|
||
t.Run("delete social account", func(t *testing.T) { | ||
t.Run("success", func(t *testing.T) { | ||
account, err := app.AccountStore.Create("[email protected]", []byte("password")) | ||
require.NoError(t, err) | ||
|
||
|
@@ -58,7 +58,7 @@ func TestDeleteOauthAccount(t *testing.T) { | |
require.Equal(t, []byte{}, test.ReadBody(res)) | ||
}) | ||
|
||
t.Run("return unprocessable entity when user requires a new password", func(t *testing.T) { | ||
t.Run("requires new password", func(t *testing.T) { | ||
expected := "{\"errors\":[{\"field\":\"password\",\"message\":\"NEW_PASSWORD_REQUIRED\"}]}" | ||
account, err := app.AccountStore.Create("[email protected]", []byte("password")) | ||
require.NoError(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 |
---|---|---|
|
@@ -20,15 +20,15 @@ func TestGetOauthInfo(t *testing.T) { | |
Value: "", | ||
}) | ||
|
||
t.Run("unanthorized", func(t *testing.T) { | ||
t.Run("unauthorized", func(t *testing.T) { | ||
res, err := client.Get("/oauth/info") | ||
require.NoError(t, err) | ||
|
||
require.Equal(t, http.StatusUnauthorized, res.StatusCode) | ||
require.Equal(t, []byte{}, test.ReadBody(res)) | ||
}) | ||
|
||
t.Run("get oauth info", func(t *testing.T) { | ||
t.Run("success", func(t *testing.T) { | ||
expected := "{\"result\":[{\"email\":\"email\",\"provider\":\"test\",\"provider_account_id\":\"ID\"}]}" | ||
account, err := app.AccountStore.Create("[email protected]", []byte("password")) | ||
require.NoError(t, err) | ||
|