pytest-play support for MQTT
Project description
play mqtt
pytest-play support for MQTT support.
Thanks to play_mqtt you can test the integration between a mocked IoT device that sends commands on MQTT and a reactive web application with UI checks.
You can also build a simulator that generates messages for you.
More info and examples on:
- pytest-play, documentation
- cookiecutter-qa, see pytest-play in action with a working example if you want to start hacking
Features
This project defines a new pytest-play command:
- provider: mqtt type: publish host: "$mqtt_host" port: $mqtt_port endpoint: "$mqtt_endpoint" payload: '{ "endpoint": "$mqtt_endpoint", "payload": { "obj_id_L": [0], "bin_value": [77251432], "measure_id": [100], "measureType": ["float"], "start_time": 1514911926114 }, "host": "$mqtt_host", "provider": "mqtt", "type": "publish", "port": "$mqtt_port"}'
Subscribe command:
test_data: - data: ciao1 --- - provider: mqtt type: subscribe host: iot.eclipse.org port: 1883 topic: "home/bedroom/light" name: "messages" - provider: mqtt type: publish host: iot.eclipse.org port: 1883 endpoint: "home/bedroom/light" payload: $data - provider: python type: wait_until timeout: 6 expression: 'len(variables["messages"]) == 1' poll: 0.1 sub_commands: [] - provider: python type: assert expression: 'len(variables["messages"]) == 1' - provider: python type: assert expression: 'variables["messages"][0] == "$data"'
Credits
This package was created with Cookiecutter and the cookiecutter-play-plugin (based on audreyr/cookiecutter-pypackage project template).
CHANGES
0.0.5 (2019-04-03)
- Implement subscribe command
0.0.4 (2019-01-26)
- Fix pypi README rendering (rif #7)
0.0.3 (2019-01-25)
- Supports new pytest-play >= 2.0 YAML based syntax (json no more supported)
- No more payload parmeter is json encodable
0.0.2 (2018-01-10)
- Commands accept kwargs now
0.0.1 (2018-01-04)
- First release
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size play_mqtt-0.0.5-py2.py3-none-any.whl (7.9 kB) | File type Wheel | Python version py2.py3 | Upload date | Hashes View |
Filename, size play_mqtt-0.0.5.tar.gz (16.6 kB) | File type Source | Python version None | Upload date | Hashes View |
Close
Hashes for play_mqtt-0.0.5-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0fb681d0a1e5a5d753846da6c518922e98ee650855ee8bbab24d5d131f3c7d73 |
|
MD5 | b5cb9e57ad38af587dc17ccbc78929e4 |
|
BLAKE2-256 | 2bf3a74dfdd31b37d73b336530e076042596a00a66f89aad040c1ff03da17534 |