add simple unit test

This commit is contained in:
Mike Kinney
2021-12-01 00:13:57 -08:00
parent ee8c124651
commit 0473820ef4
5 changed files with 22 additions and 1 deletions

View File

@@ -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

View File

Binary file not shown.

View 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'

View File

@@ -1,4 +1,5 @@
[pytest]
markers =
int: marks tests as integration
unit: marks tests as unit tests
int: marks tests as integration tests