Complete M11 Creator Studio and M12 Trust & Safety for PC5
checkpoint / checkpoint (push) Failing after 3h14m9s
checkpoint / checkpoint (push) Failing after 3h14m9s
- Creator Studio: Visual behavior & property inspector, GLB model importer, binary persistence - Trust & Safety: 18+ TOS confirmation (DOB removed), creator guidelines & briefing card on join, in-game reporting HUD - Test Harness: Add --filter, --skip-backend, --skip-godot to run_checkpoint_tests.py
This commit is contained in:
@@ -40,9 +40,10 @@ class TestRegisterRequestDob:
|
||||
date_of_birth="1990-01-01")
|
||||
assert req.date_of_birth == date(1990, 1, 1)
|
||||
|
||||
def test_dob_required(self):
|
||||
with pytest.raises(Exception):
|
||||
RegisterRequest(username="u", email="u@example.com", password="p")
|
||||
def test_dob_optional_with_over_18_default(self):
|
||||
req = RegisterRequest(username="u", email="u@example.com", password="p")
|
||||
assert req.date_of_birth is None
|
||||
assert req.over_18 is True
|
||||
|
||||
def test_bad_dob_string_rejected(self):
|
||||
with pytest.raises(Exception):
|
||||
@@ -50,6 +51,7 @@ class TestRegisterRequestDob:
|
||||
date_of_birth="not-a-date")
|
||||
|
||||
|
||||
|
||||
class TestRegisterAgeGate:
|
||||
"""End-to-end: the /register endpoint computes age from the DOB."""
|
||||
|
||||
|
||||
@@ -149,18 +149,34 @@ class TestRegister:
|
||||
assert resp.status_code == 409
|
||||
assert "Email already registered" in resp.json()["detail"]
|
||||
|
||||
def test_register_missing_dob(self):
|
||||
"""Missing the required date_of_birth field returns 422."""
|
||||
def test_register_without_dob_succeeds(self):
|
||||
"""DOB is no longer collected; registration with 18+ TOS agreement succeeds."""
|
||||
client = TestClient(app)
|
||||
resp = client.post(
|
||||
"/api/auth/register",
|
||||
json={
|
||||
"username": "user",
|
||||
"email": "user@example.com",
|
||||
"username": "adult_user_nodob",
|
||||
"email": "adult_user_nodob@example.com",
|
||||
"password": "secret123",
|
||||
"over_18": True,
|
||||
},
|
||||
)
|
||||
assert resp.status_code == 422
|
||||
assert resp.status_code == 201
|
||||
|
||||
def test_register_not_over_18_rejected(self):
|
||||
"""Declining 18+ confirmation returns 403."""
|
||||
client = TestClient(app)
|
||||
resp = client.post(
|
||||
"/api/auth/register",
|
||||
json={
|
||||
"username": "underage_declined",
|
||||
"email": "underage_declined@example.com",
|
||||
"password": "secret123",
|
||||
"over_18": False,
|
||||
},
|
||||
)
|
||||
assert resp.status_code == 403
|
||||
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@@ -199,3 +199,45 @@ class TestModerationQueue:
|
||||
# Attempting to use bad_user's token fails with 403 inactive account
|
||||
bad_me = client.get("/api/users/me", headers=bad_user["headers"])
|
||||
assert bad_me.status_code == 403
|
||||
|
||||
def test_submit_world_and_user_moderation_report(self):
|
||||
"""Test submitting general moderation reports for worlds and users."""
|
||||
client = TestClient(app)
|
||||
reporter = _register(client, "gen_reporter")
|
||||
admin = _register(client, "admin_gen_mod")
|
||||
|
||||
# Report a world
|
||||
world_rep = client.post(
|
||||
"/api/moderation/reports",
|
||||
headers=reporter["headers"],
|
||||
json={
|
||||
"target_type": "world",
|
||||
"target_id": 42,
|
||||
"reason": "Violates world guidelines",
|
||||
"category": "world_rules",
|
||||
},
|
||||
)
|
||||
assert world_rep.status_code == 201, world_rep.text
|
||||
assert "[WORLD:42]" in world_rep.json()["reason"]
|
||||
|
||||
# Report a user
|
||||
user_rep = client.post(
|
||||
"/api/moderation/reports",
|
||||
headers=reporter["headers"],
|
||||
json={
|
||||
"target_type": "user",
|
||||
"target_id": 99,
|
||||
"reason": "Harassment in world",
|
||||
"category": "harassment",
|
||||
},
|
||||
)
|
||||
assert user_rep.status_code == 201, user_rep.text
|
||||
assert "[USER:99]" in user_rep.json()["reason"]
|
||||
|
||||
# Admin lists open reports and sees both
|
||||
rep_list = client.get("/api/moderation/reports", headers=admin["headers"])
|
||||
assert rep_list.status_code == 200
|
||||
reasons = [r["reason"] for r in rep_list.json()]
|
||||
assert any("[WORLD:42]" in r for r in reasons)
|
||||
assert any("[USER:99]" in r for r in reasons)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user