forked from retoor/devplacepy
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>
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# retoor <retoor@molodetz.nl>
|
||||
|
||||
from devplacepy.database import get_table
|
||||
from tests.api.sync.conftest import follow_record, seed_world, sync_ok
|
||||
|
||||
|
||||
def local(origin, uid):
|
||||
return get_table("sync_links").find_one(origin=origin, kind="users", origin_uid=uid)["local_uid"]
|
||||
|
||||
|
||||
def test_follow_unfollow_refollow_keeps_one_row_and_has_no_side_effects(client, admin, origin):
|
||||
seed_world(client, admin, origin)
|
||||
notifications = get_table("notifications").count()
|
||||
xp = get_table("users").find_one(uid=local(origin, "u1"))["xp"]
|
||||
created = sync_ok(client, admin, "follows", origin, [follow_record("f1")])["results"][0]
|
||||
assert created["status"] == "created"
|
||||
sync_ok(client, admin, "follows", origin, [follow_record("f1", updated_at="2025-02-01T00:00:00Z", deleted=True)])
|
||||
assert get_table("follows").find_one(uid=created["local_uid"])["deleted_by"] == "sync"
|
||||
sync_ok(client, admin, "follows", origin, [follow_record("f1", updated_at="2025-03-01T00:00:00Z")])
|
||||
assert get_table("follows").count(follower_uid=local(origin, "u2"), following_uid=local(origin, "u1")) == 1
|
||||
assert get_table("follows").find_one(uid=created["local_uid"])["deleted_at"] is None
|
||||
assert get_table("notifications").count() == notifications
|
||||
assert get_table("users").find_one(uid=local(origin, "u1"))["xp"] == xp
|
||||
|
||||
|
||||
def test_self_follow_and_unknown_users(client, admin, origin):
|
||||
seed_world(client, admin, origin)
|
||||
body = sync_ok(client, admin, "follows", origin, [follow_record("f1", "u1", "u1"), follow_record("f2", "ghost", "u1"), follow_record("f3", "u2", "ghost")])
|
||||
assert [(item["status"], item["reason"]) for item in body["results"]] == [
|
||||
("rejected", "self_follow"), ("deferred", "unknown_author"), ("deferred", "unknown_author"),
|
||||
]
|
||||
Reference in New Issue
Block a user