feat: integrate operator queue into Campaign

This commit is contained in:
2026-07-29 21:10:37 +02:00
parent 2199187e8b
commit 101f3ccd7d
10 changed files with 164 additions and 64 deletions

View File

@@ -9,6 +9,7 @@ from govoplan_access.backend.db.models import Account, Group, User
from govoplan_campaign.backend.capabilities import CampaignAccessService
from govoplan_campaign.backend.db.models import Campaign, CampaignShare
from govoplan_core.core.access import PrincipalRef
from govoplan_core.core.change_sequence import ChangeSequenceEntry
from govoplan_core.db.base import Base
@@ -72,7 +73,17 @@ class CampaignAccessProviderTests(unittest.TestCase):
def _session():
engine = create_engine("sqlite:///:memory:", future=True)
Base.metadata.create_all(bind=engine, tables=[Account.__table__, User.__table__, Group.__table__, Campaign.__table__, CampaignShare.__table__])
Base.metadata.create_all(
bind=engine,
tables=[
Account.__table__,
User.__table__,
Group.__table__,
Campaign.__table__,
CampaignShare.__table__,
ChangeSequenceEntry.__table__,
],
)
return sessionmaker(bind=engine, future=True)()

View File

@@ -289,7 +289,7 @@ def test_sender_sees_queue_and_send_only_with_the_mail_contract_and_profile_auth
topic for topic in CAMPAIGN_USER_DOCUMENTATION
if topic.id == "campaigns.workflow.queue-delivery"
)
assert any(link.href == "/operator" for link in queue_topic.links)
assert any(link.href == "/campaigns/queue" for link in queue_topic.links)
def test_connected_authoring_tasks_require_their_declared_contracts_and_permissions() -> None:

View File

@@ -0,0 +1,33 @@
from __future__ import annotations
from govoplan_campaign.backend.manifest import (
OPERATOR_QUEUE_REQUIRED_ANY,
OPERATOR_QUEUE_SURFACE_ID,
get_manifest,
)
from govoplan_core.core.registry import manifest_view_surfaces
def test_operator_queue_is_an_integrated_campaign_view() -> None:
manifest = get_manifest()
assert manifest.frontend is not None
assert "/operator" not in {item.path for item in manifest.nav_items}
assert "/operator" not in {item.path for item in manifest.frontend.nav_items}
routes = {route.path: route for route in manifest.frontend.routes}
assert "/operator" not in routes
queue = routes["/campaigns/queue"]
assert queue.component == "OperatorQueuePage"
assert queue.required_all == ("campaigns:campaign:read",)
assert queue.required_any == OPERATOR_QUEUE_REQUIRED_ANY
assert OPERATOR_QUEUE_SURFACE_ID == "campaigns.route.operator"
assert queue.surface_id == OPERATOR_QUEUE_SURFACE_ID
queue_surfaces = [
surface
for surface in manifest_view_surfaces(manifest)
if surface.id == OPERATOR_QUEUE_SURFACE_ID
]
assert len(queue_surfaces) == 1
assert queue_surfaces[0].description == "/campaigns/queue"