DevPlace CI / test (push) Failing after 44m45s
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>
61 lines
2.4 KiB
Python
61 lines
2.4 KiB
Python
# retoor <retoor@molodetz.nl>
|
|
|
|
import pytest
|
|
|
|
from devplacepy.services.community.extract import split_submitter
|
|
from devplacepy.services.community.runtime import Collector
|
|
from tests.conftest import run_async
|
|
from tests.unit.services.community.dedupe import entry
|
|
from tests.unit.services.community.fakes import FakeFetcher
|
|
from tests.unit.services.community.generator import no_sleep
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"raw,expected",
|
|
[
|
|
("lore.kernel.org via thang", "thang"),
|
|
("jakearchibald.com by jaffathecake", "jaffathecake"),
|
|
("decomp.dev via FedericoSchonborn", "FedericoSchonborn"),
|
|
("via rberger 2026-10-15 12:36:38", "rberger"),
|
|
(" via spikewall", "spikewall"),
|
|
("plainname", "plainname"),
|
|
("two words", "two words"),
|
|
("", ""),
|
|
("site.org VIA Someone", "Someone"),
|
|
],
|
|
)
|
|
def test_the_submitter_is_the_person_behind_by_or_via(raw, expected):
|
|
assert split_submitter(raw) == expected
|
|
|
|
|
|
def schema():
|
|
return {
|
|
"community": "lobsters",
|
|
"origin": "lobsters.test",
|
|
"limits": {"delay_seconds": 0, "retries": 1},
|
|
"feeds": [
|
|
{
|
|
"id": "front",
|
|
"url": "https://lobsters.test/front",
|
|
"type": "json_api",
|
|
"list_path": "$.items",
|
|
"post": {"fields": {"id": ["$.id"], "title": ["$.title"], "content": ["$.body"], "created_at": ["$.at"], "url": ["$.link"]}},
|
|
"author": {"fields": {"username": ["$.who"]}},
|
|
"comments": {"mode": "none"},
|
|
}
|
|
],
|
|
}
|
|
|
|
|
|
def test_one_person_sharing_from_many_sites_is_one_user_with_one_identity():
|
|
items = [
|
|
{**entry("S1", "https://decomp.dev/a", "First"), "who": "decomp.dev via FedericoSchonborn"},
|
|
{**entry("S2", "https://costa.jacobpalm.dk/b", "Second"), "who": "costa.jacobpalm.dk via FedericoSchonborn"},
|
|
{**entry("S3", "https://abner.page/c", "Third"), "who": "abner.page by abnercoimbre"},
|
|
]
|
|
result = run_async(Collector(FakeFetcher({"https://lobsters.test/front": {"items": items}}), schema(), None, sleep=no_sleep).run(None))
|
|
users = result["records"]["users"]
|
|
assert sorted(user["username"] for user in users) == ["FedericoSchonborn", "abnercoimbre"]
|
|
posts = {post["title"]: post["author_uid"] for post in result["records"]["posts"]}
|
|
assert posts["First"] == posts["Second"] != posts["Third"]
|