mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-03 18:43:38 +01:00
Align docs/RBAC.md, docs/AUDIT_LOGGING.md, docs/CENTRALIZED_MANAGEMENT.md, and docs/MULTI_TENANT.md (plus their shipped Help mirrors) with the Business tier capabilities and Community locked-preview Settings visibility landed in #5598, and add source-bound doc-consistency checks in test_workplace_help_docs.py. Contract-Neutral: Documentation and source-bound doc-consistency tests only; no runtime, API, UI component, or persisted-state changes. Change-source: pulse-maintainer
80 lines
3.7 KiB
Python
80 lines
3.7 KiB
Python
from pathlib import Path
|
|
import re
|
|
import unittest
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[2]
|
|
|
|
|
|
def normalized(path: Path) -> str:
|
|
return " ".join(path.read_text(encoding="utf-8").split())
|
|
|
|
|
|
class WorkplaceHelpDocsTests(unittest.TestCase):
|
|
def test_business_tier_licensing_contract_matches_workplace_help_docs(self) -> None:
|
|
features_src = (ROOT / "pkg/licensing/features.go").read_text(encoding="utf-8")
|
|
self.assertIn("TierBusiness", features_src)
|
|
business_block = re.search(
|
|
r"var businessFeatures = appendFeatures\(proFeatures,(.*?)\)",
|
|
features_src,
|
|
re.DOTALL,
|
|
)
|
|
self.assertIsNotNone(business_block)
|
|
self.assertIn("FeatureWhiteLabel", business_block.group(1))
|
|
self.assertNotIn("FeatureMultiTenant", business_block.group(1))
|
|
|
|
pro_block = re.search(
|
|
r"var proFeatures = appendFeatures\(relayFeatures,(.*?)\)",
|
|
features_src,
|
|
re.DOTALL,
|
|
)
|
|
self.assertIsNotNone(pro_block)
|
|
for feature in ("FeatureRBAC", "FeatureAuditLogging", "FeatureAgentProfiles"):
|
|
self.assertIn(feature, pro_block.group(1))
|
|
|
|
rbac_doc = normalized(ROOT / "docs/RBAC.md")
|
|
self.assertIn("Pro, Business, legacy Pro+, Cloud, MSP, or Enterprise/custom license with the `rbac` capability.", rbac_doc)
|
|
self.assertIn("Confirm a Pro, Business, grandfathered Pro+, Cloud, MSP, or Enterprise/custom license is active", rbac_doc)
|
|
|
|
audit_doc = normalized(ROOT / "docs/AUDIT_LOGGING.md")
|
|
self.assertIn("Pro, Business, legacy Pro+, Cloud, MSP, or Enterprise/custom license with the `audit_logging` capability", audit_doc)
|
|
|
|
central_doc = normalized(ROOT / "docs/CENTRALIZED_MANAGEMENT.md")
|
|
self.assertIn("Pro/Business/legacy Pro+/Cloud", central_doc)
|
|
self.assertIn("included with Pro, Business, legacy Pro+, Cloud, MSP, and Enterprise/custom licences", central_doc)
|
|
|
|
multi_doc = normalized(ROOT / "docs/MULTI_TENANT.md")
|
|
self.assertIn("The Community, Relay, Pro, and Business tiers do not include the `multi_tenant` capability", multi_doc)
|
|
|
|
def test_workplace_settings_locked_preview_guidance_matches_source(self) -> None:
|
|
nav_src = (ROOT / "frontend-modern/src/components/Settings/settingsNavCatalog.ts").read_text(encoding="utf-8")
|
|
for cap in ("'auditLog'", "'auditWebhooksRead'", "'roles'", "'users'"):
|
|
self.assertIn(cap, nav_src)
|
|
|
|
infra_src = (ROOT / "frontend-modern/src/components/Settings/InfrastructureWorkspace.tsx").read_text(encoding="utf-8")
|
|
self.assertIn("hasFeature('agent_profiles') || !presentationPolicyHidesCommercialSurfaces()", infra_src)
|
|
|
|
audit_doc = normalized(ROOT / "docs/AUDIT_LOGGING.md")
|
|
self.assertIn(
|
|
"On standard self-hosted Community installs, authorised sessions see **Settings → Security → Audit Log** and **Settings → Security → Audit Webhooks** as a locked plan preview",
|
|
audit_doc,
|
|
)
|
|
|
|
central_doc = normalized(ROOT / "docs/CENTRALIZED_MANAGEMENT.md")
|
|
self.assertIn(
|
|
"On standard self-hosted Community installs, **Manage agent profiles** appears as a locked plan preview",
|
|
central_doc,
|
|
)
|
|
|
|
def test_shipped_help_mirrors_match_canonical_docs(self) -> None:
|
|
for name in ("RBAC.md", "AUDIT_LOGGING.md", "CENTRALIZED_MANAGEMENT.md", "MULTI_TENANT.md"):
|
|
with self.subTest(doc=name):
|
|
self.assertEqual(
|
|
(ROOT / "docs" / name).read_bytes(),
|
|
(ROOT / "frontend-modern/public/docs" / name).read_bytes(),
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|