Skip to content

Commit

Permalink
chore: synchronize workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Mar 1, 2024
1 parent 306b8b0 commit f230fc3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions selfservice/strategy/password/settings_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func TestSettings(t *testing.T) {
values.Set("password", x.NewUUID().String())
actual, res := testhelpers.SettingsMakeRequest(t, true, false, f, apiUser2, testhelpers.EncodeFormAsJSON(t, true, values))
assert.Equal(t, http.StatusForbidden, res.StatusCode)
assert.Contains(t, gjson.Get(actual, "error.reason").String(), "initiated by another person", "%s", actual)
assert.Contains(t, gjson.Get(actual, "error.reason").String(), "initiated by someone else", "%s", actual)
})

t.Run("type=spa", func(t *testing.T) {
Expand All @@ -213,7 +213,7 @@ func TestSettings(t *testing.T) {
values.Set("password", x.NewUUID().String())
actual, res := testhelpers.SettingsMakeRequest(t, false, true, f, browserUser2, values.Encode())
assert.Equal(t, http.StatusForbidden, res.StatusCode)
assert.Contains(t, gjson.Get(actual, "error.reason").String(), "initiated by another person", "%s", actual)
assert.Contains(t, gjson.Get(actual, "error.reason").String(), "initiated by someone else", "%s", actual)
})

t.Run("type=browser", func(t *testing.T) {
Expand All @@ -223,7 +223,7 @@ func TestSettings(t *testing.T) {
values.Set("password", x.NewUUID().String())
actual, res := testhelpers.SettingsMakeRequest(t, false, false, f, browserUser2, values.Encode())
assert.Equal(t, http.StatusForbidden, res.StatusCode)
assert.Contains(t, gjson.Get(actual, "error.reason").String(), "initiated by another person", "%s", actual)
assert.Contains(t, gjson.Get(actual, "error.reason").String(), "initiated by someone else", "%s", actual)
})
})

Expand Down
12 changes: 6 additions & 6 deletions selfservice/strategy/profile/strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -275,26 +275,26 @@ func TestStrategyTraits(t *testing.T) {

values := testhelpers.SDKFormFieldsToURLValues(f.Ui.Nodes)
actual, res := testhelpers.SettingsMakeRequest(t, true, false, f, apiUser2, testhelpers.EncodeFormAsJSON(t, true, values))
assert.Equal(t, http.StatusBadRequest, res.StatusCode)
assert.Contains(t, gjson.Get(actual, "ui.messages.0.text").String(), "initiated by another person", "%s", actual)
assert.Equal(t, http.StatusForbidden, res.StatusCode)
assert.Contains(t, gjson.Get(actual, "ui.messages.0.text").String(), "initiated by someone else", "%s", actual)
})

t.Run("type=spa", func(t *testing.T) {
f := testhelpers.InitializeSettingsFlowViaAPI(t, browserUser1, publicTS)

values := testhelpers.SDKFormFieldsToURLValues(f.Ui.Nodes)
actual, res := testhelpers.SettingsMakeRequest(t, false, true, f, browserUser2, testhelpers.EncodeFormAsJSON(t, true, values))
assert.Equal(t, http.StatusBadRequest, res.StatusCode)
assert.Contains(t, gjson.Get(actual, "ui.messages.0.text").String(), "initiated by another person", "%s", actual)
assert.Equal(t, http.StatusForbidden, res.StatusCode)
assert.Contains(t, gjson.Get(actual, "ui.messages.0.text").String(), "initiated by someone else", "%s", actual)
})

t.Run("type=browser", func(t *testing.T) {
f := testhelpers.InitializeSettingsFlowViaBrowser(t, browserUser1, false, publicTS)

values := testhelpers.SDKFormFieldsToURLValues(f.Ui.Nodes)
actual, res := testhelpers.SettingsMakeRequest(t, false, false, f, browserUser2, values.Encode())
assert.Equal(t, http.StatusOK, res.StatusCode)
assert.Contains(t, gjson.Get(actual, "ui.messages.0.text").String(), "initiated by another person", "%s", actual)
assert.Equal(t, http.StatusForbidden, res.StatusCode)
assert.Contains(t, gjson.Get(actual, "ui.messages.0.text").String(), "initiated by someone else", "%s", actual)
})
})

Expand Down

0 comments on commit f230fc3

Please sign in to comment.