Alternera.Resource.Test.Host (alternera_resource_sdk v0.9.0)

Copy Markdown View Source

The host a package's own tests run against, with no proxy around.

An actor is a map: %{system: true} for the system, or %{id: uuid, roles: %{tenant_id => role}}, where any role may read and :tenant_admin may write. Resources are available unless a test turns them off with put_available(false); the setting is per process (and the processes it starts, through $callers), so async tests do not see each other's. changed/3 sends {:resource_changed, tenant_id, name, key} to the calling process, so a test can assert_received it.

Summary

Functions

A stand-in user with role in each of tenant_ids.

Makes resources available or not for the calling process and its callees.

Functions

actor(tenant_ids, role \\ :tenant_admin)

@spec actor([String.t()], atom()) :: map()

A stand-in user with role in each of tenant_ids.

put_available(available)

@spec put_available(boolean()) :: :ok

Makes resources available or not for the calling process and its callees.