emobtest
Test and conformance toolkit for EV charging platforms: stations and cars that charge on any CSMS over OCPP, a meter that signs OCMF, the checks a receipt and an Eichrecht chain make, the rating an invoice uses, an inbox for CloudEvents, and suites that hold a replacement service to the contract it replaces.
The erasure suite restores a cut of the provider, billing and receivables journals against current customer key custody. It checks sign-in, the original erasure receipt, a second driver and a partially paid invoice. The shared-invoice suite partially pays a two-driver fleet invoice, checks a line credit’s UBL, tests payer and driver access and reopens the credit after a restart. The withdrawal suite charges a private card, allocates a payment, records a declaration and reconciles the original invoice, credit and entitlement across restart. The finance suite imports a statement, checks open cash against the archived UBL and retries a confirmation after replay. The estate suite also signs in as a private payer, two fleet drivers, a billing delegate and an unrelated user. It compares downloaded UBL to the original and exercises live revocation, provider restart and a billing outage.
Built on emob's own Rust crates, so a test asserts with the code that bills; it speaks only public contracts — OCPP, OCMF, HTTP, CloudEvents with Standard Webhooks, DATEX II — so it tests any platform, not only emob.
pip install emobtest
No runtime dependencies; one abi3 wheel for Python ≥ 3.11.
Sixty seconds
import emobtest as et
meter = et.Meter(seed=7) # signs OCMF, deterministically
records = meter.charge("30", start="2026-12-01T10:00:00+01:00", minutes=12)
et.assert_verifies(records[-1], meter.public_key) # this key signed these bytes
et.assert_bills(records, meter.public_key, kwh="30") # …and MessEG §33 lets it bill
tariff = et.Tariff(energy="0.59", session_fee="0.50") # gross, as a driver is shown
tariff.total(kwh=30, power_kw=150) # Decimal('18.20') — rated, not multiplied
tariff.preisstand # '59CA' — the code on page, display, receipt
et.assert_price(invoice_line_total, tariff, kwh=30, power_kw=150)
A changed digit fails the way it should:
tampered = records[-1].replace('"RV":', '"RV":1', 1)
et.assert_tampered(tampered, meter.public_key)
et.assert_not_billable([*records[:-1], tampered], meter.public_key).reasons
Money and energy are never floats: Tariff(energy=0.59) is a ValueError.
AssertionError means the system under test is wrong; ValueError means the
test is.
Run the external suite against emob
From the workspace root, just e2e builds the daemons and starts a private example estate on ephemeral loopback ports with fresh credentials and journals. The suite checks successful and refused charges, point prices, reservations, provider quotes and station tariff delivery. It also reviews, confirms and reverses card restrictions from the actual desk forms, restarts the provider on its original journal, then checks card history and charging again. These mutations run only in the runner’s disposable estate. The OCPP 2.x simulator issues a fresh transaction ID across reconnects. The suite checks the recorded decision for that exact ID. Two drivers charge against one fleet account. The suite withdraws an offer, rejects a tampered charge, advances the billing clock, checks the retail UBL against the simulated meter quantities and reopens the same document after restart. The runner stops its own estate on exit. It can run alongside a local demo.
Driving a CSMS
with et.Station("wss://csms.example/ocpp", "CP-1", password="…", ocpp="2.0.1") as cp:
cp.expect_display("Preisstand")
session = cp.charge(card="04A1B2C3D4E5F6", car=et.Car.compact(soc=20), minutes=30)
session.assert_accepted().assert_bills() # billed what the meter signed
cp.charge(card="04A1B2C3D4E5F6", fault="tampered") # the CSMS must not bill this
OCPP 1.6, 2.0.1 and 2.1 over ws:// or wss://: ocpp-kit's wallbox and
vehicle, an emob-sim meter signing every register reading (register
cp.meter_key with the CSMS). Thirty minutes play in a second. Faults:
tampered, dropped. Its sessions are real to the CSMS — on production, use
your own test card.
A ReserveNow is answered Accepted and kept: cp.reservations lists what
the CSMS holds the station for. et.Emsp() answers a CSMS's authorisation as empd does, and misbehaves on
cue: .on(uid).accepts(), .blocks(), .expired(), .stalls(3),
.fails(503).
Receiving events
def test_a_session_reaches_the_erp(inbox, platform):
platform.subscribe(url=inbox.url, secret=inbox.secret) # your platform's API
platform.run_a_session()
cdr = inbox.expect("de.emob.cdr.issued", within=10) # signed, schema-checked
et.assert_bills(cdr.data["signed"], METER_KEY)
The inbox checks every delivery's Standard Webhooks signature and the event's
published schema, answers 204, 200 for a duplicate id and 401 for a
delivery it cannot trust — what a well-behaved receiver does.
Conformance
The integration OpenAPI document describes the service operations and outbound webhooks. Run the suite for the port your system provides.
emobtest conformance mcp emob mcp
emobtest conformance receiver https://erp.example/emob --secret-env EMOB_WEBHOOK_SECRET
emobtest conformance receiver https://erp.example/invoices --event-type de.emob.invoice.issued --secret-env EMOB_INVOICE_DELIVERY_SECRET
emobtest conformance tariff https://prices.example --tariff-id ad-hoc
emobtest conformance authorize https://emsp.example --token-env EMOB_SERVICE_TOKEN --known 04A1B2 --blocked 04FFEE
receiver · https://erp.example/emob
✓ a signed delivery is taken — 204 in 41 ms
✓ the same delivery again is taken, not an error — 200 in 12 ms
✗ a delivery signed with another secret is refused — 204 in 9 ms — anyone could post a record that bills
✓ a delivery fifteen minutes old is refused — 401 in 8 ms
✓ an unsigned delivery is refused — 401 in 7 ms
✗ 4/5 held — does not conform
receiver is for an ERP, a billing system or any subscriber in place of
billd; authorize is for an eMSP backend in place of empd, held to the
answer csmsd asks for within its two-second budget. The tariff suite checks the current seller document against its schema and reads that exact version by fingerprint. In pytest,
conformance.receiver(url, secret).assert_passed().
The mcp suite launches the local command you specify on standard input and output. It discovers the tools, checks the meter verifier with a signed sample and a different meter’s key, exercises input limits, and waits for a clean exit. To check a replacement, substitute its executable and arguments for emob mcp.
Recover a subscriber event
Use the original event ID and the named subscriber’s existing webhook secret. Point the command at csmsd for a charge detail record (de.emob.cdr.issued) or billd for an invoice (de.emob.invoice.issued). Supply the secret through the named environment variable.
emobtest recover https://billing.example.org --subscriber erp \
--event-type de.emob.invoice.issued --id R-2026-0001 \
--secret-env EMOB_ERP_WEBHOOK_SECRET > invoice-event.json
A successful command writes the authenticated envelope bytes to stdout. It checks the fresh signature, original delivery and envelope IDs, issuing source, and published event schema before writing anything. Errors go to stderr and return a nonzero status. Responses are limited to 8 MiB. The request goes directly to the configured issuer over HTTPS, or HTTP on loopback for a local estate. In Python, emobtest.recover_event(url, subscriber, event_type, event_id, secret=secret) returns the same bytes.
On the command line
emobtest verify 'OCMF|{…}|{…}' 3059… does this key sign this record?
emobtest price --energy 0.59 --kwh 30 --power 150
emobtest feed table.json will the Mobilithek take it?
emobtest inbox --port 9199 show events live, checked
pytest
The plugin loads itself. Fixtures: meter, inbox, emsp, tariff,
emob_seed, and station — a factory dialling --emob-ocpp URL (trusting
--emob-ca PEM), skipped without it. Option --emob-seed N.
Also
meter.sign(kwh, at=…, marker="C") for a record a session would not produce
on its own; et.evse_id(…) and et.emaid(…), check digit computed and
checked; et.check_feed(bytes) and et.assert_feed(…) for a DATEX II AFIR
file; et.event_problems(…); et.webhooks.sign/verify.
Licence: MIT OR Apache-2.0, as emob.
Metadata
Release files for emobtest 0.8.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Actions Reset | |||
|---|---|---|---|---|
| emobtest-0.8.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details for emobtest-0.8.0-cp311-abi3-win_amd64.whl |
| emobtest-0.8.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details for emobtest-0.8.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
| emobtest-0.8.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details for emobtest-0.8.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
| emobtest-0.8.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details for emobtest-0.8.0-cp311-abi3-macosx_11_0_arm64.whl |
| emobtest-0.8.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details for emobtest-0.8.0-cp311-abi3-macosx_10_12_x86_64.whl |
Total release size: 51.2 MB
Release files / emobtest-0.8.0-cp311-abi3-win_amd64.whl
| Download URL | emobtest-0.8.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 10.2 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
f3b7845be15706405edfb1b2bca7c3abc7dfe74da0fc8970bab417058c11c284
|
|
BLAKE2b-256 checksum How to use checksums |
5ab042ce83deb47f392114466fd5554e5481dc89646f43bfe2bbfba3c5197132
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / emobtest-0.8.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | emobtest-0.8.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 10.5 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
82444850401c6dbb6def43ee31ce7c6e1ea2ea6ff57105026149b34e64407991
|
|
BLAKE2b-256 checksum How to use checksums |
f537be39925101bd361de74d310b01456ff1668431cbd479032929d5cac58c60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / emobtest-0.8.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | emobtest-0.8.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 10.5 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
bb92d5814b23c03f1ba660083d693cb84383708503988ed8c986c7ea09500f16
|
|
BLAKE2b-256 checksum How to use checksums |
78c2516985bbdd3a698b474e2c321ffbf651f69974a0253668636c2695323e79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / emobtest-0.8.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | emobtest-0.8.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 9.7 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
850d3ac9cc1b83c332f89061f5b18ec46da5ff73fc49827934179b417af36d37
|
|
BLAKE2b-256 checksum How to use checksums |
508dc3bc2352bcd8bb8c883350eefe9ebcba06bdbe55c76a94ee5b87bc1eba08
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logRelease files / emobtest-0.8.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | emobtest-0.8.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 10.2 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
6b6a9fc6a47b49bb45edbdc42a5e4de3304a52606600cebc9f7ca3006f502f5b
|
|
BLAKE2b-256 checksum How to use checksums |
65fb52d7e30431cea50b974529afb3536f18a16b48cb71cfcb0ea9c03e974ee4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logSecurity for emobtest 0.8.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 5 files in this release have been uploaded with provenance metadata.
Attestation for emobtest-0.8.0-cp311-abi3-win_amd64.whl
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 28, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.