MCPcopy
hub / github.com/ory/hydra / TestFlow_HandleConsentError

Function TestFlow_HandleConsentError

flow/flow_test.go:206–225  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

204}
205
206func TestFlow_HandleConsentError(t *testing.T) {
207 for _, state := range []State{FlowStateConsentInitialized, FlowStateConsentUnused, FlowStateConsentError} {
208 f := Flow{}
209 require.NoError(t, faker.FakeData(&f))
210 f.State = state
211
212 expected := RequestDeniedError{}
213 require.NoError(t, faker.FakeData(&expected))
214
215 require.NoError(t, f.HandleConsentError(&expected))
216 assert.Equal(t, FlowStateConsentError, f.State)
217 assert.WithinDuration(t, time.Now(), time.Time(f.ConsentHandledAt), 5*time.Second)
218 assert.Equal(t, &expected, f.ConsentError)
219
220 assert.Zero(t, f.ConsentRemember)
221 assert.Zero(t, f.ConsentRememberFor)
222 assert.Zero(t, f.GrantedScope)
223 assert.Zero(t, f.GrantedAudience)
224 }
225}

Callers

nothing calls this directly

Calls 2

HandleConsentErrorMethod · 0.95
NowMethod · 0.65

Tested by

no test coverage detected