Some checks failed
Use-case regression gate / usecase-regressions (push) Failing after 6m2s
Assistant: codex Assistant-Model: gpt-6.1-sol Assistant-Session: 01a10e2d-a5ef-7e92-b03d-b1694e915680
62 lines
2.9 KiB
Python
62 lines
2.9 KiB
Python
"""UC-008 synthetic acceptance; contains no private ReichelAg notes."""
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
from django.urls import reverse
|
|
|
|
from coulomb_social.apps.members.models import Member, User
|
|
from coulomb_social.apps.spaces import pageops
|
|
from coulomb_social.apps.spaces.models import SpaceMembership
|
|
from coulomb_social.apps.spaces.services import create_space, put_space_page
|
|
|
|
|
|
@pytest.mark.usecase("CSOC-UC-008")
|
|
@pytest.mark.django_db
|
|
def test_full_protocol_duplicate_edit_and_clipboard_control(tmp_path, settings, client):
|
|
settings.CONTENT_ROOT = str(tmp_path / "content")
|
|
user = User.objects.create_user(username="writer")
|
|
member = Member.objects.create(
|
|
user=user, tenant_id="tenant:a", user_engine_user_id="writer",
|
|
issuer="https://issuer.test", subject="writer",
|
|
)
|
|
space = create_space(member, title="Synthetic weekly calls", slug="weekly-calls")
|
|
scenario = json.loads((Path(__file__).parent / "usecases/fixtures/reichelag-weekly-call.json")
|
|
.read_text(encoding="utf-8"))
|
|
body = scenario["previous_body"]
|
|
put_space_page(member, space, "previous-call", title="Previous call", body=body)
|
|
client.force_login(user)
|
|
response = client.post(reverse("spaces:page_copy", kwargs={
|
|
"slug": space.slug, "page_slug": "previous-call",
|
|
}), {"dest_space": space.slug, "dest_slug": "next-call", "title": "Next call"})
|
|
assert response.status_code == 302
|
|
assert pageops.read_page(space.slug, "next-call").body == body
|
|
assert pageops.read_page(space.slug, "previous-call").body == body
|
|
edited = scenario["next_body"]
|
|
response = client.post(reverse("spaces:page_edit", kwargs={
|
|
"slug": space.slug, "page_slug": "next-call",
|
|
}), {"title": "Next call", "slug": "next-call", "body": edited})
|
|
assert response.status_code == 302
|
|
assert pageops.read_page(space.slug, "previous-call").body == body
|
|
response = client.get(reverse("spaces:detail", kwargs={"slug": space.slug}) + "?page=next-call")
|
|
assert response.status_code == 200
|
|
assert b"Copy content to clipboard" in response.content
|
|
assert b"Duplicate page" in response.content
|
|
assert b'id="page-content"' in response.content
|
|
assert b"Follow-up point" in response.content
|
|
assert b"spaces/copy-content.js" in response.content
|
|
assert b"Completed point" not in response.content
|
|
|
|
# A reader can export what they can read, without getting authoring controls.
|
|
membership = SpaceMembership.objects.get(space=space, member=member)
|
|
membership.role = "viewer"
|
|
membership.save()
|
|
response = client.get(reverse("spaces:detail", kwargs={"slug": space.slug}) + "?page=next-call")
|
|
assert b"Copy content to clipboard" in response.content
|
|
assert b"Duplicate page" not in response.content
|
|
|
|
unavailable = client.get(
|
|
reverse("spaces:detail", kwargs={"slug": space.slug}) + "?page=missing"
|
|
)
|
|
assert b"Copy content to clipboard" not in unavailable.content
|