mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
100% Coverage
This commit is contained in:
@@ -5,6 +5,7 @@ from __future__ import annotations
|
||||
import pytest
|
||||
from roboco.enforcement.notification_perms import (
|
||||
NotificationPermissionError,
|
||||
_can_send_to_recipient,
|
||||
get_notification_scope,
|
||||
validate_notification_permission,
|
||||
)
|
||||
@@ -65,3 +66,23 @@ def test_validate_fails_on_first_unreachable() -> None:
|
||||
def test_unknown_agent_cannot_send() -> None:
|
||||
with pytest.raises(NotificationPermissionError):
|
||||
validate_notification_permission("ghost-agent", ["be-pm"])
|
||||
|
||||
|
||||
def test_can_send_to_recipient_developer_role_blocked() -> None:
|
||||
"""_can_send_to_recipient with no can_send → role-blocked reason (line 51)."""
|
||||
|
||||
can_send, reason = _can_send_to_recipient("be-dev-1", "be-pm")
|
||||
assert can_send is False
|
||||
assert "developer" in reason
|
||||
|
||||
|
||||
def test_board_member_list_scope_can_notify_listed_target() -> None:
|
||||
"""Lines 73-75: list-scope sender notifies recipient in list."""
|
||||
# product_owner has list scope including 'main-pm'.
|
||||
assert validate_notification_permission("product-owner", ["main-pm"]) is True
|
||||
|
||||
|
||||
def test_board_member_list_scope_cannot_notify_unlisted_target() -> None:
|
||||
"""Lines 76-77: list-scope sender to unlisted target → False reason."""
|
||||
with pytest.raises(NotificationPermissionError):
|
||||
validate_notification_permission("product-owner", ["be-dev-1"])
|
||||
|
||||
Reference in New Issue
Block a user