aeat.application.user_profile._testing module

Test conveniences over the canonical user-profile orchestration.

Wraps register_active_profile() with a curated set of required schema-validated placeholder facts so unit tests can register a profile in one call without reciting six placeholder values every time. An explicit SecureObjectRepository may be injected to bind the helper to an in-process ephemeral store.

This is a TEST helper and lives in the canonical package because it composes only canonical surfaces.

register_minimal_profile(state, *, profile_id, display_name=None, overrides=None, secure_objects=None, enforce_unique_tax_id=True)[source]

Register profile_id with the minimum required schema facts.

Parameters:
  • state (WorkflowState) – Current WorkflowState.

  • profile_id (str) – Canonical profile identifier (also the bucket id).

  • display_name (str | None) – Operator-visible label. Defaults to profile_id.

  • overrides (Mapping[str, str] | None) – Optional schema-path → string overrides applied on top of the placeholder facts (also accepts paths not in the required set; they merge in).

  • secure_objects (SecureObjectRepository | None) – Optional injected SecureObjectRepository.

  • enforce_unique_tax_id (bool) – When False, skip the cross-bucket tax-id uniqueness scan. Use in per-bucket-storage test scenarios where each profile’s encrypted record lives in its own SQLite file and opening a second bucket session to scan a previously-created profile is not possible within the current active session. Matches the CLI profile create behaviour (which also passes enforce_unique_tax_id=False).

Return type:

WorkflowState

Returns:

The state with the profile registered + activated and the profile.created / profile.selected workflow events appended.