Clean architecture (core use cases + infra gateways), X25519/AES-GCM E2E encryption, tkinter GUI, and a pytest suite. 45 tests passing.
40 lines
800 B
Python
40 lines
800 B
Python
"""Shared fixtures for the test suite."""
|
|
|
|
import base64
|
|
|
|
import pytest
|
|
|
|
from neotalk.core.entities.identity import Identity
|
|
from tests.fakes import FakeCrypto
|
|
|
|
|
|
@pytest.fixture
|
|
def crypto() -> FakeCrypto:
|
|
return FakeCrypto()
|
|
|
|
|
|
@pytest.fixture
|
|
def shared_key(crypto: FakeCrypto) -> bytes:
|
|
return crypto.derive_shared_key(b"peer-public-key")
|
|
|
|
|
|
@pytest.fixture
|
|
def identity() -> Identity:
|
|
return Identity(
|
|
peer_id="local-id",
|
|
alias="ana",
|
|
public_key=b"local-public-key",
|
|
tcp_port=50600,
|
|
)
|
|
|
|
|
|
@pytest.fixture
|
|
def hello_datagram() -> dict:
|
|
return {
|
|
"v": 1,
|
|
"type": "hello",
|
|
"peer_id": "remote-id",
|
|
"alias": "bob",
|
|
"tcp_port": 50601,
|
|
"pubkey": base64.b64encode(b"remote-public-key").decode("ascii"),
|
|
}
|