Add pytest config and key derivation tests

This commit is contained in:
thePR0M3TH3AN
2025-06-29 23:06:22 -04:00
parent c8b54fc791
commit 0088211193
3 changed files with 23 additions and 2 deletions

View File

@@ -181,11 +181,11 @@ You can manage the relay list or change the PIN through the **Settings** menu:
## Running Tests
SeedPass includes a small suite of unit tests. After activating your virtual environment and installing dependencies, run the tests with **pytest**:
SeedPass includes a small suite of unit tests. After activating your virtual environment and installing dependencies, run the tests with **pytest**. Use `-vv` to see INFO-level log messages from each passing test:
```bash
pip install -r src/requirements.txt
pytest
pytest -vv
```
## Security Considerations

3
pytest.ini Normal file
View File

@@ -0,0 +1,3 @@
[pytest]
log_cli = true
log_cli_level = INFO

View File

@@ -0,0 +1,18 @@
import logging
import pytest
from utils.key_derivation import derive_key_from_password
def test_derive_key_deterministic():
password = "correct horse battery staple"
key1 = derive_key_from_password(password, iterations=1)
key2 = derive_key_from_password(password, iterations=1)
assert key1 == key2
assert len(key1) == 44
logging.info("Deterministic key derivation succeeded")
def test_derive_key_empty_password_error():
with pytest.raises(ValueError):
derive_key_from_password("")
logging.info("Empty password correctly raised ValueError")