Attesto.Test.CodeStoreAgent (Attesto v2.28.0)

Copy Markdown View Source

Agent-backed authorization-code store fixture for a host's tests.

Use this module to define a named, in-memory test double with the Attesto.CodeStore callbacks and helpers for inspecting captured grants. It is a lightweight fixture, not a production store or a reference for storage validation and retention. Use Attesto.Test.CodeStoreContract to test a host's store implementation instead.

defmodule Host.CodeStoreFixture do
  use Attesto.Test.CodeStoreAgent
end

Start the generated module with start_supervised!(Host.CodeStoreFixture) in a synchronous ExUnit case, or call its start_link/1 directly. It is registered under its module name. reset/0 clears all entries, count/0 returns their number, and peek/1 hashes a raw code and returns its snapshot or nil. entry/1 hashes a raw code and returns the internal fixture entry, raising KeyError when absent. No ExUnit code runs when Attesto compiles.

Summary

Functions

Define a named Agent code-store fixture and its inspection helpers.

Functions

__using__(opts)

(macro)

Define a named Agent code-store fixture and its inspection helpers.