fritz-sim
A fake FRITZ!Box for tests. fritz-sim serves recorded and anonymized
fixtures of real devices over TR-064 on the loopback interface, so a client
can be tested end to end without a router and without ever sending a change
to a real one.
Unofficial, not affiliated with FRITZ! GmbH.
- Serves the device description, the service descriptions (SCPD) and the action calls with HTTP Digest authentication, over HTTP or HTTPS with a self-signed certificate
- Checks every call against the service description: unknown actions fail with UPnP error 401, missing or unknown arguments with 402, values that don't fit the data type with 600
- Keeps state: a call like
SetEnablechanges the values that the matching getters return afterwards - Serves the list documents (hosts, mesh, calls, phonebook), the session
login of the web interface (
login_sid.lua, PBKDF2) and the Smart Home REST API - Injects UPnP errors (like 866, 867 or 868 for the second factor), delays, discarded writes and a locked login, and records every request
Fixtures
The fixtures come with the crate:
| Fixture | Device | FRITZ!OS |
|---|---|---|
fritzbox-7690/8.25 |
FRITZ!Box 7690 | 8.25 |
fritz-sim --list prints them. Every fixture is a directory with the files
of one device; see Fixture
for the layout.
More devices make every project that tests against fritz-sim better. If
your FRITZ!Box model or FRITZ!OS version is missing, please contribute a
fixture. Recording it only reads from
the device, and the anonymizer replaces addresses, names and other personal
values before anything leaves your machine. The steps are in
CONTRIBUTING.md.
In Rust tests
[]
= "0.1"
use ;
async
Fixture::bundled_names() lists all fixtures, to run a test against each of
them.
In other languages
The binary serves a fixture until it is interrupted, so tests in any language can start it and point their client at it:
It prints listening on http://127.0.0.1:49000 once it accepts calls. With
--https it serves a new self-signed certificate and prints its SHA-256
fingerprint on the next line. The credentials are fritz-sim and
fritz-sim-password, or those of --username and --password. --fixture
also takes the directory of a fixture that does not come with the crate.
License
Apache-2.0