Available on crate feature
testkit only.Expand description
Building blocks for testing an OCPI integration: sample objects and in-memory stores.
Everything here is deliberately dependency-light — no HTTP mocking framework, no test runner — so it can be used from a unit test, an integration test, a fuzz target or a demo binary without dragging a stack along.
use ocpi_kit::testkit::{sample, InMemoryLocations};
use ocpi_kit::types::Validate;
let location = sample::location("LOC1")?;
location.validate()?;
let store = InMemoryLocations::new();
store.put(location.clone());
assert_eq!(store.get("loc1").unwrap().id, location.id);Re-exports§
pub use stores::InMemoryCdrs;pub use stores::InMemoryLocations;pub use stores::InMemorySessions;pub use stores::InMemoryTariffs;pub use stores::InMemoryTokens;
Modules§
- sample
- Valid sample objects, for tests that need an object rather than a specific one.
- stores
- In-memory object stores, with pagination that behaves the way the specification describes.
Structs§
- Mock
Peer server - A conformant OCPI party, held in memory.
- Mock
Peer Stores server - The objects a
MockPeerserves, reached through itsDeref.
Functions§
- bootstrap_
peer server - An
AuthenticatedPeerthat still holdsCREDENTIALS_TOKEN_A, for testing the scope rule. - registered_
peer server - An
AuthenticatedPeerfor a fully registered platform. - test_
cpo - The party a test CPO speaks as.
- test_
hub - The party a test hub speaks as.
- test_
msp - The party a test eMSP speaks as.
- test_
token - A credentials token with a fixed, obviously-fake value.