(t *testing.T)
| 620 | } |
| 621 | |
| 622 | func TestUpdateLegacyChallenges(t *testing.T) { |
| 623 | t.Skip("this test is used to update the fixtures only, they should not be updated unless we have a breaking change (so probably never)") |
| 624 | |
| 625 | reg := testhelpers.NewRegistryMemory(t, |
| 626 | driver.WithConfigOptions(configx.WithValue(config.KeyGetSystemSecret, []string{"well-known-fixture-secret"})), |
| 627 | driver.WithServiceLocatorOptions(servicelocatorx.WithContextualizer(&contextx.Static{NID: legacyChallengesNID})), |
| 628 | ) |
| 629 | |
| 630 | for name, flowState := range map[string]flow.State{ |
| 631 | "login_initialized": flow.FlowStateLoginInitialized, |
| 632 | "login_unused": flow.FlowStateLoginUnused, |
| 633 | "login_used": flow.FlowStateLoginUsed, |
| 634 | "login_error": flow.FlowStateLoginError, |
| 635 | "consent_initialized": flow.FlowStateConsentInitialized, |
| 636 | "consent_unused": flow.FlowStateConsentUnused, |
| 637 | "consent_used": flow.FlowStateConsentUsed, |
| 638 | "consent_error": flow.FlowStateConsentError, |
| 639 | "device_initialized": flow.DeviceFlowStateInitialized, |
| 640 | "device_unused": flow.DeviceFlowStateUnused, |
| 641 | "device_used": flow.DeviceFlowStateUsed, |
| 642 | } { |
| 643 | f := createTestFlow(legacyChallengesNID, flowState) |
| 644 | var challenge string |
| 645 | var err error |
| 646 | switch flowState { |
| 647 | case flow.FlowStateLoginInitialized, flow.FlowStateLoginUnused, flow.FlowStateLoginUsed, flow.FlowStateLoginError: |
| 648 | challenge, err = f.ToLoginChallenge(t.Context(), reg) |
| 649 | case flow.FlowStateConsentInitialized, flow.FlowStateConsentUnused, flow.FlowStateConsentUsed, flow.FlowStateConsentError: |
| 650 | challenge, err = f.ToConsentChallenge(t.Context(), reg) |
| 651 | case flow.DeviceFlowStateInitialized, flow.DeviceFlowStateUnused, flow.DeviceFlowStateUsed: |
| 652 | challenge, err = f.ToDeviceChallenge(t.Context(), reg) |
| 653 | default: |
| 654 | t.Fatalf("unknown flow state: %d", flowState) |
| 655 | } |
| 656 | require.NoError(t, err) |
| 657 | |
| 658 | require.NoError(t, os.WriteFile(fmt.Sprintf("fixtures/legacy_challenges/%s.txt", name), []byte(challenge), 0o644)) |
| 659 | } |
| 660 | } |
nothing calls this directly
no test coverage detected