# ABOUTME: Tests for security-related functionality. # ABOUTME: Verifies password wiping, PAM cleanup, and lockscreen bypass prevention. from moonlock.auth import _wipe_bytes class TestPasswordWiping: """Tests for sensitive data cleanup.""" def test_wipe_bytes_zeroes_bytearray(self): data = bytearray(b"secretpassword") _wipe_bytes(data) assert data == bytearray(len(b"secretpassword")) assert all(b == 0 for b in data) def test_wipe_bytes_handles_empty(self): data = bytearray(b"") _wipe_bytes(data) assert data == bytearray(b"") def test_wipe_bytes_handles_bytes_gracefully(self): # Regular bytes are immutable, wipe should be a no-op data = b"secret" _wipe_bytes(data) # should not raise