moo.core.tests.utils

Shared helpers for moo.core tests.

Functions

add_verb(obj, name, code_str, owner, **kwargs)

Create a Verb + VerbName directly via ORM, bypassing permission checks.

ctx(caller[, writer])

Open a ContextManager session for the given caller.

exec_verb(src[, caller, writer])

Run verb source in the restricted environment, return printed output.

make_restricted_globals(writer)

Build a restricted execution globals dict for the given writer.

mock_caller([is_wizard])

Minimal caller stand-in that satisfies is_wizard() checks (no DB needed).

raises_in_verb(src, exc[, caller])

Assert that running src in the restricted environment raises the given exception.