FakeServer class final
A fake of the server for the integration tests of the client (15 20 row "Integration").
It keeps a FakeWorld in memory, serves the REST subset of brief M4-17 Design note 3 and the gateway, checks DPoP proofs, validates every request, response and frame against the API documents (violations) and injects the faults of its faults plan. One fake per test; stop closes every socket. There is no global state, so parallel tests start their own fakes.
Example:
final server = await FakeServer.start();
final world = WorldSeed.standard(server.world);
// configure the client with server.baseUri (plain http, test builds only)
server.faults.dropResponseAfterCommit('createMessage');
// ...
expect(server.violations, isEmpty);
await server.stop();
Properties
- actions → ActionCatalog
-
The action catalogue of
docs/spec/actions.yaml(brief M4-26 Design note 3).final - audit → FakeAuditLog
-
The audit log behind
listAuditEvents,exportAuditEventsandverifyAuditChain(brief M4-29); a test adds rows and breaks the chain with FakeAuditLog.tamper.final - baseUri → Uri
-
The address of the fake,
http://127.0.0.1:<port>(plain HTTP: test builds only).no setter - faults → FaultPlan
-
The fault plan.
final
- gateway → GatewayFake
-
The gateway side.
final
- gatewayUri → Uri
-
The gateway address,
ws://127.0.0.1:<port>/api/v1/gateway.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
-
objectStorePuts
→ List<
String> -
Every part PUT to the object store of a
presignedsession (12 3.3), in order.final -
requests
→ List<
FakeRequestRecord> -
Every REST request, in order.
no setter
- rest → RestFake
-
The REST side; handle adds operations.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- terminalStreams → TerminalStreamFake
-
The device streams of the terminal at
/api/v1/terminal/sessions/{id}/stream, relayed toworld.terminal.hostLink(brief M4-36).final - verifier → DpopVerifier
-
The DPoP check; DpopVerifier.rotateNonce makes the current nonce the previous one.
final
-
violations
→ List<
String> -
Every contract violation of a request, response or frame, with its JSON Pointer; a test
expects this list to be empty.
no setter
- world → FakeWorld
-
The world.
final
Methods
-
actionOf(
String operationId) → String? -
The authorization action of
operationId(x-authz-action), or null when it names none. -
addAgent(
String agentId, AgentScript script) → ScriptedAgent -
Adds and attaches a scripted agent for
agentIdthat playsscripton every mention. -
disconnect(
{String? deviceId}) → void -
Ends the gateway connections of
deviceId(all when null) without a close code, as a lost network does. -
handle(
String operationId, FakeHandler handler) → void -
Registers
handlerforoperationId(the handler registry of Design note 3). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
requestsOf(
String operationId) → List< FakeRequestRecord> -
The requests of
operationId. -
stepUpOf(
String operationId) → String -
The
step_upvalue (true,false,fresh,conditional) of the action ofoperationIdindocs/spec/actions.yaml;falsefor an operation without an action. -
stop(
) → Future< void> - Stops the agents, closes every socket and the listener.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
start(
{FakeServerOptions options = const FakeServerOptions()}) → Future< FakeServer> -
Starts a fake on
127.0.0.1with a free port.