Files
devplacepy/tests/api/sync/reactions.py
T
retoorandClaude Sonnet 5.5 02ab747cd0
DevPlace CI / test (push) Failing after 44m45s
Code Farm: per-plot auto-replant pause and crop-lock check; community sync and node work
Continuous Delivery could never be turned off once a crop was planted. Add a
one-shot per-plot "stop after harvest" flag (POST /game/plot/stop, Devii tool
game_plot_stop, game_plots.stop_after_harvest), cleared by the next plant,
autoreplant claim or Refactor. Autoreplant now also respects crop locks through
the shared _crop_lock predicate. Plan and measurements in happyplanting.md.

Also includes the pending community sync, node network and related work in the
tree; the full suite passed (4999) with all of it.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-17 02:23:43 +02:00

34 lines
2.0 KiB
Python

# retoor <retoor@molodetz.nl>
from devplacepy.database import get_table
from tests.api.sync.conftest import reaction_record, seed_world, sync_ok
def local(origin, kind, origin_uid):
return get_table("sync_links").find_one(origin=origin, kind=kind, origin_uid=origin_uid)["local_uid"]
def test_reactions_are_created_toggled_and_revived(client, admin, origin):
seed_world(client, admin, origin)
created = sync_ok(client, admin, "reactions", origin, [reaction_record("r1")])["results"][0]
assert created["status"] == "created"
row = get_table("reactions").find_one(uid=created["local_uid"])
assert (row["emoji"], row["target_type"], row["target_uid"]) == ("🔥", "post", local(origin, "posts", "p1"))
sync_ok(client, admin, "reactions", origin, [reaction_record("r1", updated_at="2025-02-01T00:00:00Z", deleted=True)])
assert get_table("reactions").find_one(uid=created["local_uid"])["deleted_by"] == "sync"
sync_ok(client, admin, "reactions", origin, [reaction_record("r1", updated_at="2025-03-01T00:00:00Z")])
assert get_table("reactions").find_one(uid=created["local_uid"])["deleted_at"] is None
def test_a_different_emoji_is_a_different_reaction_and_text_is_refused(client, admin, origin):
seed_world(client, admin, origin)
body = sync_ok(client, admin, "reactions", origin, [reaction_record("r1"), reaction_record("r2", emoji="👍"), reaction_record("r3", emoji="nope")])
assert [item["status"] for item in body["results"]] == ["created", "created", "rejected"]
assert get_table("reactions").count(user_uid=local(origin, "users", "u2"), target_uid=local(origin, "posts", "p1")) == 2
def test_reactions_on_comments_and_projects_wait_for_their_target(client, admin, origin):
seed_world(client, admin, origin)
body = sync_ok(client, admin, "reactions", origin, [reaction_record("r1", target="c1", kind="comment"), reaction_record("r2", target="pr1", kind="project"), reaction_record("r3", target="ghost")])
assert [item["status"] for item in body["results"]] == ["created", "created", "deferred"]