Files
SenSu/tests/test_auth.py
T
AskaEth e6875f0b4b Initial commit: SenSu Alpha 0.2.0
- 13-service async plugin framework
- Textual TUI with CLI fallback
- Plugin hot-reload + permission system
- Web management panel (aiohttp)
- Bridge-based inter-module communication
- 10 regression tests

Fixes applied:
- PBKDF2-SHA256 auth (was plain SHA256)
- Auth bypass removed (was allow-all on fail)
- Bare excepts replaced with logged errors
- CatFramework/DreamSu -> SenSu naming unified
- ServiceManager: health checks + startup_order
- Env var credentials (SENSU_ADMIN_PASSWORD etc)
2026-06-10 12:28:05 +08:00

13 lines
563 B
Python

import pytest,os
from services.auth_service import AuthService
class TestAuthService:
def test_hash_consistent(self):
s=AuthService({});assert s._hash_password("x")==s._hash_password("x")
def test_hash_len(self):
assert len(AuthService({})._hash_password("x"))==64
def test_invalid_login(self):
assert AuthService({}).authenticate_user("admin","WRONG") is None
def test_valid_login(self):
pw=os.environ.get("SENSU_ADMIN_PASSWORD","admin123")
assert AuthService({}).authenticate_user("admin",pw) is not None