Expand description
Fake MOTIS 2 server on loopback, for tests of clients of its API.
The responses come from fixtures/, trimmed answers of the
Transitous instance of MOTIS for Frankfurt (Main)
Hauptbahnhof and Hauptwache. Injections change them,
to produce cancellations, delays and errors on demand. Every request is
recorded, so tests can check what was sent, and that nothing was sent.
use motis_sim::{Injection, Sim};
let sim = Sim::start().await;
sim.inject(Injection::Cancel { trip_id: motis_sim::DIRECT_TRIP.into() });
// point the client under test at sim.base_url()
assert_eq!(sim.requests().len(), 0);Structs§
Enums§
- Endpoint
- The endpoints the sim serves.
- Injection
- A change to the answers of the sim. Injections stay until
Sim::clear.
Constants§
- CONNECTING_
TRIP - The second trip of that connection: the U1 at 21:25 from Willy-Brandt-Platz to Hauptwache.
- DEPARTURE_
TRIP - A running departure of the stoptimes fixture: the tram 14.
- DIRECT_
TRIP - The trip of the first connection in the plan fixture, also the answer of
Endpoint::Trip: the S4 from Hauptbahnhof tief to Hauptwache. - FEEDER_
TRIP - The first trip of the connection with a transfer in the plan fixture: the U5 at 21:20 from Hauptbahnhof to Willy-Brandt-Platz.