Skip to content

Commit

Permalink
fix: resolve remaining testing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Sep 13, 2020
1 parent a4021ed commit af40d93
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion driver/configuration/provider_viper.go
Expand Up @@ -476,7 +476,7 @@ func (p *ViperProvider) SelfServiceFlowVerificationRequestLifespan() time.Durati
}

func (p *ViperProvider) SelfServiceFlowVerificationReturnTo(defaultReturnTo *url.URL) *url.URL {
redir, err := url.ParseRequestURI(viperx.GetString(p.l, ViperKeySelfServiceSettingsAfter+"."+DefaultBrowserReturnURL, ""))
redir, err := url.ParseRequestURI(viperx.GetString(p.l, ViperKeySelfServiceVerificationBrowserDefaultReturnTo, ""))
if err != nil {
return defaultReturnTo
}
Expand Down
5 changes: 3 additions & 2 deletions driver/configuration/provider_viper_test.go
Expand Up @@ -9,6 +9,7 @@ import (
"time"

"github.com/ory/x/logrusx"
"github.com/ory/x/urlx"

_ "github.com/ory/jsonschema/v3/fileloader"

Expand Down Expand Up @@ -406,14 +407,14 @@ func TestViperProvider_ReturnTo(t *testing.T) {
p := configuration.NewViperProvider(l, false)

viper.Set(configuration.ViperKeySelfServiceBrowserDefaultReturnTo, "https://www.ory.sh/")
assert.Equal(t, "https://www.ory.sh/", p.SelfServiceFlowVerificationReturnTo().String())
assert.Equal(t, "https://www.ory.sh/", p.SelfServiceFlowVerificationReturnTo(urlx.ParseOrPanic("https://www.ory.sh/")).String())
assert.Equal(t, "https://www.ory.sh/", p.SelfServiceFlowRecoveryReturnTo().String())

viper.Set(configuration.ViperKeySelfServiceRecoveryBrowserDefaultReturnTo, "https://www.ory.sh/recovery")
assert.Equal(t, "https://www.ory.sh/recovery", p.SelfServiceFlowRecoveryReturnTo().String())

viper.Set(configuration.ViperKeySelfServiceVerificationBrowserDefaultReturnTo, "https://www.ory.sh/verification")
assert.Equal(t, "https://www.ory.sh/verification", p.SelfServiceFlowVerificationReturnTo().String())
assert.Equal(t, "https://www.ory.sh/verification", p.SelfServiceFlowVerificationReturnTo(urlx.ParseOrPanic("https://www.ory.sh/")).String())
}

func TestViperProvider_DSN(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion selfservice/strategy/link/strategy_recovery.go
Expand Up @@ -487,7 +487,7 @@ func (s *Strategy) decodeRecovery(r *http.Request, decodeBody bool) (*completeSe
if err := s.dx.Decode(r, &body,
decoderx.MustHTTPRawJSONSchemaCompiler(
x.MustPkgerRead(pkger.Open("/selfservice/strategy/link/.schema/email.schema.json")),
),
),
decoderx.HTTPDecoderSetValidatePayloads(false),
decoderx.HTTPDecoderJSONFollowsFormFormat()); err != nil {
return nil, err
Expand Down
4 changes: 2 additions & 2 deletions selfservice/strategy/link/strategy_verification_test.go
Expand Up @@ -224,8 +224,8 @@ func TestVerification(t *testing.T) {

assert.Equal(t, http.StatusOK, res.StatusCode)
assert.Contains(t, res.Request.URL.String(), conf.SelfServiceFlowVerificationUI().String())
body :=string(x.MustReadAll(res.Body))
assert.EqualValues(t, "passed_challenge", gjson.Get(body,"state").String())
body := string(x.MustReadAll(res.Body))
assert.EqualValues(t, "passed_challenge", gjson.Get(body, "state").String())

id, err := reg.PrivilegedIdentityPool().GetIdentityConfidential(context.Background(), identityToVerify.ID)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion selfservice/strategy/password/settings.go
Expand Up @@ -138,7 +138,7 @@ func (s *Strategy) submitSettingsFlow(w http.ResponseWriter, r *http.Request, ps
}

func (s *Strategy) decodeSettingsFlow(r *http.Request, dest interface{}) error {
compiler, err := decoderx.HTTPRawJSONSchemaCompiler( x.MustPkgerRead(pkger.Open("/selfservice/strategy/password/.schema/settings.schema.json")))
compiler, err := decoderx.HTTPRawJSONSchemaCompiler(x.MustPkgerRead(pkger.Open("/selfservice/strategy/password/.schema/settings.schema.json")))
if err != nil {
return errors.WithStack(err)
}
Expand Down
1 change: 1 addition & 0 deletions x/config.go
Expand Up @@ -2,6 +2,7 @@ package x

import (
"github.com/markbates/pkger"

"github.com/ory/x/logrusx"
"github.com/ory/x/viperx"
)
Expand Down

0 comments on commit af40d93

Please sign in to comment.