diff --git a/README.md b/README.md index d220cfc..970e8bc 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/meshtastic/test/.test_node.py.swp b/meshtastic/test/.test_node.py.swp new file mode 100644 index 0000000..1df257b Binary files /dev/null and b/meshtastic/test/.test_node.py.swp differ diff --git a/meshtastic/tests/test_int.py b/meshtastic/test/test_int.py similarity index 100% rename from meshtastic/tests/test_int.py rename to meshtastic/test/test_int.py diff --git a/meshtastic/test/test_node.py b/meshtastic/test/test_node.py new file mode 100644 index 0000000..0650aa5 --- /dev/null +++ b/meshtastic/test/test_node.py @@ -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' diff --git a/pytest.ini b/pytest.ini index 35e4231..9c7d72e 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,4 +1,5 @@ [pytest] markers = - int: marks tests as integration + unit: marks tests as unit tests + int: marks tests as integration tests