mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-12-03 18:43:38 +01:00
Update scripts/tests/test_admin_docs.py to expect the Business tier
wording merged into docs/WEBHOOKS.md in #5614 (17efc5ea1b), which
currently fails Public docs and Script smoke tests on main.
Re-apply the Business tier and Community workplace Settings preview
updates from closed PR #5615 across docs/README.md, docs/FAQ.md,
docs/DEPLOYMENT_MODELS.md, docs/PRODUCTION_SECURITY.md, their shipped
Help mirrors under frontend-modern/public/docs/, and
scripts/tests/test_production_rollout_docs.py and
scripts/tests/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
122 lines
5.9 KiB
Python
122 lines
5.9 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_overview_guides_align_with_business_tier_and_community_previews(self) -> None:
|
|
docs_readme = normalized(ROOT / "docs/README.md")
|
|
for phrase in (
|
|
"[Centralized agent management](CENTRALIZED_MANAGEMENT.md) (Pro / Business)",
|
|
"[Role-based access control](RBAC.md) (Pro / Business)",
|
|
"[Audit logging](AUDIT_LOGGING.md) (Pro / Business)",
|
|
"[Plans and entitlements](PULSE_PRO.md) (Community, Pro, Business, and continuing Relay subscribers)",
|
|
):
|
|
with self.subTest(doc="docs/README.md", phrase=phrase):
|
|
self.assertIn(phrase, docs_readme)
|
|
|
|
faq = normalized(ROOT / "docs/FAQ.md")
|
|
for phrase in (
|
|
"### What do Pro, Business, and Cloud unlock?",
|
|
"Business ($399/yr) adds unlimited team seats, custom application header and PDF report branding (`white_label`)",
|
|
"workplace Settings tabs (**Data & Reports**, **Roles**, **Users**, **Audit Log**, **Audit Webhooks**) remain visible in Settings as locked previews.",
|
|
):
|
|
with self.subTest(doc="docs/FAQ.md", phrase=phrase):
|
|
self.assertIn(phrase, faq)
|
|
|
|
deployment = normalized(ROOT / "docs/DEPLOYMENT_MODELS.md")
|
|
self.assertIn("**Relay/Pro/Business/legacy Pro+/Cloud license**: `license.enc`", deployment)
|
|
self.assertIn("**RBAC roles**: `rbac_roles.json` (Pro/Business/legacy Pro+/Cloud)", deployment)
|
|
|
|
prod_sec = normalized(ROOT / "docs/PRODUCTION_SECURITY.md")
|
|
for phrase in (
|
|
"## Community, Pro, and Business boundaries",
|
|
"Business ($399/yr) includes all Pro capabilities plus unlimited team seats, custom application header and PDF report branding (`white_label`)",
|
|
"workplace Settings tabs (**Data & Reports**, **Roles**, **Users**, **Audit Log**, **Audit Webhooks**) remain visible in Settings as locked previews",
|
|
):
|
|
with self.subTest(doc="docs/PRODUCTION_SECURITY.md", phrase=phrase):
|
|
self.assertIn(phrase, prod_sec)
|
|
|
|
def test_shipped_help_mirrors_match_canonical_docs(self) -> None:
|
|
for name in (
|
|
"RBAC.md",
|
|
"AUDIT_LOGGING.md",
|
|
"CENTRALIZED_MANAGEMENT.md",
|
|
"MULTI_TENANT.md",
|
|
"README.md",
|
|
"FAQ.md",
|
|
"DEPLOYMENT_MODELS.md",
|
|
"PRODUCTION_SECURITY.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()
|