Inserts providers and connections for consumer test suites.
Compiled with the library so a consumer can call it from its own tests. Requires the configured Tango repo, encryption key, and the caller's test database ownership. Does not check out a sandbox, change application config, make HTTP calls, or delete rows. Cleanup stays with the caller.
Accepts atom-key attribute maps. provider_id and tenant_id always come
from the insert_connection!/3 arguments.
Summary
Functions
Inserts a connection for provider and tenant_id.
Inserts a provider with unique example.test endpoints.
Functions
@spec insert_connection!(Tango.Schemas.Provider.t(), String.t(), map()) :: Tango.Schemas.Connection.t()
Inserts a connection for provider and tenant_id.
An omitted access token or refresh token becomes a random dummy. An
explicit nil access token is rejected. An explicit nil refresh token,
scope list, subject, or expiry is stored as NULL, so a database default
does not replace it. Omitted scopes default to records.read, and an
omitted oauth_client_id comes from the provider config. Attributes
cannot change the provider or tenant. A failed changeset raises
Ecto.InvalidChangesetError. Database constraints still apply.
@spec insert_provider!(map()) :: Tango.Schemas.Provider.t()
Inserts a provider with unique example.test endpoints.
Omitted fields receive a unique slug, name, client secret, records.read,
and a config map containing client_id, auth_url, and token_url.
Passed attributes replace those defaults. An invalid provider raises
Ecto.InvalidChangesetError.