mirror of
https://github.com/PR0M3TH3AN/SeedPass.git
synced 2025-09-09 15:58:48 +00:00
Merge pull request #51 from PR0M3TH3AN/codex/add-pytest.ini-and-logging-for-tests
Add logging-enabled tests and pytest config
This commit is contained in:
@@ -181,11 +181,11 @@ You can manage the relay list or change the PIN through the **Settings** menu:
|
|||||||
|
|
||||||
## Running Tests
|
## 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
|
```bash
|
||||||
pip install -r src/requirements.txt
|
pip install -r src/requirements.txt
|
||||||
pytest
|
pytest -vv
|
||||||
```
|
```
|
||||||
|
|
||||||
## Security Considerations
|
## Security Considerations
|
||||||
|
3
pytest.ini
Normal file
3
pytest.ini
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[pytest]
|
||||||
|
log_cli = true
|
||||||
|
log_cli_level = INFO
|
18
src/tests/test_key_derivation.py
Normal file
18
src/tests/test_key_derivation.py
Normal 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")
|
Reference in New Issue
Block a user