mirror of
https://github.com/meshtastic/python.git
synced 2025-12-31 11:57:57 -05:00
add simple unit test
This commit is contained in:
@@ -169,3 +169,7 @@ To test, first install this code locally, then run pytest:
|
||||
pip3 install .
|
||||
pytest
|
||||
```
|
||||
Possible options for testing:
|
||||
* for more verbosity, add "-v" or even "-vv" like this: pytest -vv
|
||||
* to run just unit tests: pytest -munit
|
||||
* to run just integrstion tests: pytest -mint
|
||||
|
||||
BIN
meshtastic/test/.test_node.py.swp
Normal file
BIN
meshtastic/test/.test_node.py.swp
Normal file
Binary file not shown.
16
meshtastic/test/test_node.py
Normal file
16
meshtastic/test/test_node.py
Normal file
@@ -0,0 +1,16 @@
|
||||
"""Meshtastic unit tests for node.py"""
|
||||
import re
|
||||
import subprocess
|
||||
import platform
|
||||
|
||||
import pytest
|
||||
|
||||
from meshtastic.node import pskToString
|
||||
|
||||
@pytest.mark.unit
|
||||
def test_pskToString():
|
||||
"""Test pskToString"""
|
||||
assert pskToString('') == 'unencrypted'
|
||||
assert pskToString(bytes([0x00])) == 'unencrypted'
|
||||
assert pskToString(bytes([0x01])) == 'default'
|
||||
assert pskToString(bytes([0x02, 0x01])) == 'secret'
|
||||
@@ -1,4 +1,5 @@
|
||||
[pytest]
|
||||
|
||||
markers =
|
||||
int: marks tests as integration
|
||||
unit: marks tests as unit tests
|
||||
int: marks tests as integration tests
|
||||
|
||||
Reference in New Issue
Block a user