pryscraper/tests/test_gdpr.py
cryptorugmunch 0ecc250349 refactor(pry): rename 19 root modules to pry_<name> to remove naming collision with routers/
The duplicate file names (advanced, agency, auth, compliance, costing, etc.) in
both root and routers/ made imports ambiguous. Renamed root modules to
pry_<name>.py so:

  from quality import X     ->  from pry_quality import X
  from routers.quality import router  (unchanged)

Also:
- Renamed x402.py to pry_x402/ package directory
- Fixed 21+ bare imports across api.py, deps.py, routers/, tests/, llm_providers/

Tests: 593 passed, 1 skipped (test_ready_returns_200 fails pre-existing
because Ollama is unreachable from test env, unrelated to this refactor).

Audit item 8.
2026-07-06 10:25:44 +02:00

64 lines
1.9 KiB
Python

# SPDX-License-Identifier: MIT
# Copyright (c) 2026 Rug Munch Media LLC
#
# Part of Pry — https://git.rugmunch.io/RugMunchMedia/pryscraper
# Licensed under MIT. See LICENSE.
"""Tests for GDPR compliance portal."""
from pry_gdpr import (
check_consent,
get_retention_policy,
process_deletion,
record_consent,
revoke_consent,
)
def test_record_consent() -> None:
import asyncio
result = asyncio.run(record_consent("user@example.com", "data_collection", True))
assert result["success"] is True
assert result["consent"]["consent_given"] is True
def test_check_consent_given() -> None:
import asyncio
asyncio.run(record_consent("check@example.com", "data_collection", True))
result = check_consent("check@example.com", "data_collection")
assert result["consent_given"] is True
assert result["valid"] is True
def test_check_consent_not_given() -> None:
result = check_consent("nonexistent@example.com", "data_collection")
assert result["consent_given"] is False
def test_revoke_consent() -> None:
import asyncio
asyncio.run(record_consent("revoke@example.com", "data_collection", True))
result = revoke_consent("revoke@example.com", "data_collection")
assert result["success"] is True
# Verify revocation
check = check_consent("revoke@example.com", "data_collection")
assert check["consent_given"] is False
def test_process_deletion() -> None:
import asyncio
asyncio.run(record_consent("delete@example.com", "data_collection", True))
result = process_deletion("delete@example.com")
assert result["success"] is True
# Verify consent gone
check = check_consent("delete@example.com", "data_collection")
assert check["consent_given"] is False
def test_retention_policy() -> None:
policy = get_retention_policy()
assert "consent_records" in policy
assert "quality_history" in policy