@salesforce/afv-skills 1.71.0 → 1.72.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/skills/agentforce-generate/SKILL.md +8 -0
- package/skills/agentforce-generate/assets/agents/README.md +1 -1
- package/skills/agentforce-generate/references/actions-reference.md +4 -0
- package/skills/agentforce-generate/references/mcp-actions-in-agent-script.md +233 -0
- package/skills/agentforce-generate/references/reference-map.md +1 -0
- package/skills/dx-packaging-convert-1gp-to-2gp-create/SKILL.md +9 -7
- package/skills/dx-packaging-convert-1gp-to-2gp-create/references/conversion-operations.md +78 -4
- package/skills/dx-packaging-move-to-2gp-migrate/SKILL.md +17 -13
- package/skills/dx-packaging-move-to-2gp-migrate/references/api-operations.md +110 -9
- package/skills/experience-app-mcp-generate/references/troubleshooting.md +1 -1
- package/skills/experience-app-mcp-generate/scripts/merge_tools.mjs +49 -18
- package/skills/experience-app-mcp-generate/scripts/render_eca.mjs +1 -1
- package/skills/experience-app-mcp-generate/scripts/render_mcp_server.mjs +1 -1
- package/skills/experience-app-mcp-generate/scripts/scan_tool_candidates.mjs +3 -1
- package/skills/experience-ui-bundle-custom-app-generate/SKILL.md +32 -26
- package/skills/experience-ui-bundle-custom-app-generate/references/configure-metadata-custom-application.md +6 -24
- package/skills/nonprofit-fundraising-configure/references/mcp-invocation.md +4 -6
- package/skills/platform-apex-generate/SKILL.md +2 -1
- package/skills/platform-apex-generate/assets/abstract.cls +0 -4
- package/skills/platform-apex-generate/assets/invocable-action-extension.invocableactionextension-meta.xml +28 -0
- package/skills/platform-apex-generate/assets/invocable.cls +2 -0
- package/skills/platform-apex-generate/references/dml-declarations.md +69 -0
- package/skills/platform-metadata-discovery-get/SKILL.md +15 -10
- package/skills/platform-metadata-grounding-get/SKILL.md +5 -3
- package/skills/service-add-agents-to-contact-center-create/SKILL.md +138 -0
- package/skills/service-agentforce-contact-center-coordinate/SKILL.md +5 -5
- package/skills/service-agentforce-contact-center-coordinate/references/omni-flow-routing.md +3 -3
- package/skills/service-agentforce-contact-center-coordinate/scripts/create-routing-flows.sh +8 -3
- package/skills/service-agentforce-contact-center-coordinate/scripts/create-voice-agent.sh +5 -5
- package/skills/service-agentforce-contact-center-coordinate/scripts/resolve-acc-queue.sh +10 -1
- package/skills/service-agentforce-contact-center-coordinate/scripts/resolve-channel-line.sh +4 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/resolve-flow-definition.sh +5 -0
- package/skills/service-agentforce-contact-center-coordinate/scripts/verify-number-live.sh +6 -1
- package/skills/service-concierge-portal-generate/SKILL.md +1 -1
- package/skills/service-concierge-portal-generate/references/portal-deploy-runbook.md +21 -8
- package/skills/service-digital-engagement-channel-configure/SKILL.md +45 -32
- package/skills/service-digital-engagement-channel-configure/assets/public_key_certificate_set_jwks_template.xml +20 -0
- package/skills/service-digital-engagement-channel-configure/assets/public_key_certificate_set_jwks_url_template.xml +23 -0
- package/skills/service-digital-engagement-channel-configure/assets/public_key_certificate_template.xml +15 -0
- package/skills/service-digital-engagement-channel-configure/examples/asa_agent_channel.xml +1 -1
- package/skills/service-digital-engagement-channel-configure/examples/auth_queue_channel.xml +3 -3
- package/skills/service-digital-engagement-channel-configure/examples/jwks_upload_key.xml +11 -0
- package/skills/service-digital-engagement-channel-configure/examples/jwks_upload_keyset.xml +13 -0
- package/skills/service-digital-engagement-channel-configure/examples/jwks_url_keyset.xml +17 -0
- package/skills/service-digital-engagement-channel-configure/examples/omni_flow_channel.xml +3 -3
- package/skills/service-digital-engagement-channel-configure/examples/omni_queue_channel.xml +3 -3
- package/skills/service-digital-engagement-channel-configure/examples/user_channel.xml +1 -1
- package/skills/service-digital-engagement-channel-configure/references/_vendored/service-onboarding-delegation-guidelines.md +43 -0
- package/skills/service-digital-engagement-channel-configure/references/channel_settings.md +1 -1
- package/skills/service-digital-engagement-channel-configure/references/keyset_settings.md +46 -0
- package/skills/service-digital-engagement-channel-configure/references/keyset_setup.md +42 -0
- package/skills/service-digital-engagement-channel-configure/references/onboarding_contract.md +28 -27
- package/skills/service-digital-engagement-channel-configure/references/recaptcha_handoff.md +2 -5
- package/skills/service-digital-engagement-channel-configure/references/routing_transitions.md +2 -2
- package/skills/service-digital-engagement-channel-configure/references/user_verification.md +3 -4
- package/skills/service-digital-engagement-channel-configure/references/user_verification_client.md +51 -0
- package/skills/service-digital-engagement-channel-configure/scripts/check-api-version.sh +7 -0
- package/skills/service-digital-engagement-deployment-configure/SKILL.md +28 -10
- package/skills/service-digital-engagement-deployment-configure/references/_vendored/service-onboarding-delegation-guidelines.md +43 -0
- package/skills/service-digital-engagement-deployment-configure/references/branding_and_tooling.md +2 -2
- package/skills/service-digital-engagement-deployment-configure/references/code_snippet.md +2 -2
- package/skills/service-digital-engagement-deployment-configure/references/connect_api_creation.md +13 -7
- package/skills/service-digital-engagement-deployment-configure/references/custom_labels.md +127 -0
- package/skills/service-digital-engagement-deployment-configure/references/deployment_settings.md +2 -1
- package/skills/service-digital-engagement-deployment-configure/references/onboarding_contract.md +24 -25
- package/skills/service-digital-engagement-deployment-configure/references/prechat_forms.md +1 -1
- package/skills/service-digital-engagement-deployment-configure/scripts/check-api-version.sh +7 -0
- package/skills/service-email-to-case-configure/SKILL.md +89 -80
- package/skills/service-email-to-case-configure/assets/CaseSettings.settings-meta.xml +1 -1
- package/skills/service-email-to-case-configure/examples/CaseSettings-two-addresses.settings-meta.xml +6 -3
- package/skills/service-email-to-case-configure/references/_vendored/service-onboarding-delegation-guidelines.md +43 -0
- package/skills/service-email-to-case-configure/references/agent-delegation.md +22 -0
- package/skills/service-email-to-case-configure/references/apply-mechanics.md +15 -12
- package/skills/service-email-to-case-configure/references/end-to-end-proof.md +14 -0
- package/skills/service-email-to-case-configure/references/onboarding-delegated-run.md +66 -0
- package/skills/service-email-to-case-configure/references/routing_address_reference.md +6 -2
- package/skills/service-email-to-case-configure/references/troubleshooting.md +17 -9
- package/skills/service-email-to-case-configure/scripts/apply-casesettings.py +863 -925
- package/skills/service-email-to-case-configure/scripts/tests/_agent.py +162 -0
- package/skills/service-email-to-case-configure/scripts/tests/_fakeorg.py +119 -155
- package/skills/service-email-to-case-configure/scripts/tests/_run.py +10 -17
- package/skills/service-email-to-case-configure/scripts/tests/test_apply_org_scenarios.py +14 -14
- package/skills/service-email-to-case-configure/scripts/tests/test_dispatch_contract.py +316 -0
- package/skills/service-email-to-case-configure/scripts/tests/test_new_capabilities.py +12 -43
- package/skills/service-email-to-case-configure/scripts/tests/test_validate_casesettings.py +13 -0
- package/skills/service-email-to-case-configure/scripts/validate-casesettings.py +17 -5
- package/skills/service-itsm-agentic-setup-incident-management/references/status-checks.md +11 -11
- package/skills/service-remove-agents-from-contact-center-assign/SKILL.md +145 -0
- package/skills/service-voice-configuration-manage/SKILL.md +206 -0
- package/skills/service-voice-configuration-manage/assets/regions.json +23 -0
- package/skills/service-voice-configuration-manage/references/lookups.md +91 -0
- package/skills/service-voice-configuration-manage/references/voice_config_api.md +169 -0
- package/skills/service-voice-configuration-manage/scripts/create-configuration.sh +20 -0
- package/skills/service-voice-configuration-manage/scripts/delete-configuration.sh +31 -0
- package/skills/service-voice-configuration-manage/scripts/get-configuration.sh +18 -0
- package/skills/service-voice-configuration-manage/scripts/lib.sh +22 -0
- package/skills/service-voice-configuration-manage/scripts/list-configurations.sh +18 -0
- package/skills/service-voice-configuration-manage/scripts/lookup-caller-lines.sh +30 -0
- package/skills/service-voice-configuration-manage/scripts/lookup-flows.sh +29 -0
- package/skills/service-voice-configuration-manage/scripts/lookup-profiles.sh +29 -0
- package/skills/service-voice-configuration-manage/scripts/lookup-users.sh +29 -0
- package/skills/service-voice-configuration-manage/scripts/update-configuration.sh +20 -0
- package/skills/tableau-next-asset-create/SKILL.md +10 -4
- package/skills/tableau-next-asset-create/references/dashboard-design-principles.md +133 -0
- package/skills/tableau-next-asset-create/references/data-transform-gotchas.md +284 -128
- package/skills/tableau-next-asset-create/references/deep-reference-index.md +3 -3
- package/skills/tableau-next-asset-create/references/edit-dashboard.md +1 -1
- package/skills/tableau-next-asset-create/references/edit-visualization.md +678 -468
- package/skills/tableau-next-asset-create/references/shared-gates.md +1 -1
- package/skills/tableau-next-asset-create/references/tasks/create-data-transform.md +120 -42
- package/skills/tableau-next-asset-create/references/tasks/create-viz.md +8 -0
- package/skills/tableau-next-asset-create/references/tasks/edit-viz.md +7 -4
- package/skills/tableau-next-asset-create/references/tasks/promote-or-reuse.md +9 -4
- package/skills/tableau-next-asset-create/references/viz-authoring.md +1 -1
- package/skills/service-email-to-case-configure/scripts/tests/test_get_session.py +0 -134
|
@@ -15,7 +15,7 @@ Plus the optional-toggle guarantees:
|
|
|
15
15
|
* when the user opts OUT of a toggle (it is absent from the source file), it
|
|
16
16
|
is NOT written and the org keeps its current value.
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
The agent's dispatch loop runs against FakeOrg — no live org required.
|
|
19
19
|
"""
|
|
20
20
|
from __future__ import annotations
|
|
21
21
|
|
|
@@ -54,7 +54,7 @@ AUTOMATED_USER_FIELDS = ("defaultCaseUser", "useSystemUserAsDefaultCaseUser",
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
def automated_user_payload(org):
|
|
57
|
-
"""The automated-user fields carried by the Phase A
|
|
57
|
+
"""The automated-user fields carried by the Phase A PUT write."""
|
|
58
58
|
for w in org.writes:
|
|
59
59
|
if any(f in w for f in AUTOMATED_USER_FIELDS):
|
|
60
60
|
return {f: w[f] for f in AUTOMATED_USER_FIELDS if f in w}
|
|
@@ -74,7 +74,7 @@ class Scenario1_NoSupportNoToggles(unittest.TestCase):
|
|
|
74
74
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
75
75
|
path = write_input(d, src)
|
|
76
76
|
summary = run_main(apply_mod, [
|
|
77
|
-
"--
|
|
77
|
+
"--input", path,
|
|
78
78
|
"--routing-email", "support@acme.com",
|
|
79
79
|
"--owner-type", "User", "--owner-value", ADMIN,
|
|
80
80
|
"--automated-type", "User", "--automated-value", ADMIN,
|
|
@@ -107,7 +107,7 @@ class Scenario2_SupportSetNoToggles(unittest.TestCase):
|
|
|
107
107
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
108
108
|
path = write_input(d, src)
|
|
109
109
|
summary = run_main(apply_mod, [
|
|
110
|
-
"--
|
|
110
|
+
"--input", path,
|
|
111
111
|
"--routing-email", "support@acme.com",
|
|
112
112
|
])
|
|
113
113
|
self.assertEqual(summary["supportSettings"]["action"],
|
|
@@ -132,7 +132,7 @@ class Scenario2b_PartialSupportSettings(unittest.TestCase):
|
|
|
132
132
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
133
133
|
path = write_input(d, src)
|
|
134
134
|
return run_main(apply_mod, [
|
|
135
|
-
"--
|
|
135
|
+
"--input", path,
|
|
136
136
|
"--routing-email", "support@acme.com", *extra])
|
|
137
137
|
|
|
138
138
|
def test_owner_set_supply_only_automated_user(self):
|
|
@@ -303,7 +303,7 @@ class Scenario3_ToggleOnNoOnDemand(unittest.TestCase):
|
|
|
303
303
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
304
304
|
path = write_input(d, src)
|
|
305
305
|
summary = run_main(apply_mod, [
|
|
306
|
-
"--
|
|
306
|
+
"--input", path,
|
|
307
307
|
"--routing-email", "support@acme.com",
|
|
308
308
|
])
|
|
309
309
|
self.assertTrue(org.state["emailToCase"]["enableOnDemandEmailToCase"])
|
|
@@ -322,7 +322,7 @@ class Scenario4_AllTogglesNoAddress(unittest.TestCase):
|
|
|
322
322
|
src = Input().with_default_toggles().build() # no .address()
|
|
323
323
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
324
324
|
path = write_input(d, src)
|
|
325
|
-
summary = run_main(apply_mod, ["--
|
|
325
|
+
summary = run_main(apply_mod, ["--input", path])
|
|
326
326
|
self.assertEqual(summary["phaseB"], [])
|
|
327
327
|
self.assertEqual(summary["verified"]["routingAddressCount"], 0)
|
|
328
328
|
self.assertTrue(org.state["emailToCase"]["enableEmailToCase"])
|
|
@@ -362,7 +362,7 @@ class Scenario5_NewAddressNotEdit(unittest.TestCase):
|
|
|
362
362
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
363
363
|
path = write_input(d, src)
|
|
364
364
|
summary = run_main(apply_mod, [
|
|
365
|
-
"--
|
|
365
|
+
"--input", path,
|
|
366
366
|
"--routing-email", "billing@acme.com",
|
|
367
367
|
])
|
|
368
368
|
self.assertEqual(summary["verified"]["routingAddressCount"], 2)
|
|
@@ -394,7 +394,7 @@ class Scenario5_NewAddressNotEdit(unittest.TestCase):
|
|
|
394
394
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
395
395
|
path = write_input(d, src)
|
|
396
396
|
summary = run_main(apply_mod, [
|
|
397
|
-
"--
|
|
397
|
+
"--input", path,
|
|
398
398
|
"--routing-email", "support@acme.com",
|
|
399
399
|
])
|
|
400
400
|
self.assertEqual(summary["phaseB"][0]["status"], "already_exists")
|
|
@@ -449,7 +449,7 @@ class MultiAddressOrderingPreservation(unittest.TestCase):
|
|
|
449
449
|
caseOrigin="Email", casePriority="Medium")
|
|
450
450
|
emails.append(email)
|
|
451
451
|
src = builder.build()
|
|
452
|
-
args = [
|
|
452
|
+
args = []
|
|
453
453
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
454
454
|
path = write_input(d, src)
|
|
455
455
|
args += ["--input", path]
|
|
@@ -512,7 +512,7 @@ class Scenario6_SupportSettingsTypes(unittest.TestCase):
|
|
|
512
512
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
513
513
|
path = write_input(d, src)
|
|
514
514
|
return run_main(apply_mod,
|
|
515
|
-
["--
|
|
515
|
+
["--input", path, *extra])
|
|
516
516
|
|
|
517
517
|
def test_user_owner_and_user_automated(self):
|
|
518
518
|
org = fresh_org(active_users=[ADMIN, AUTH])
|
|
@@ -559,7 +559,7 @@ class Scenario7_PerAddressCaseOwner(unittest.TestCase):
|
|
|
559
559
|
**addr_kw).build())
|
|
560
560
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
561
561
|
path = write_input(d, src)
|
|
562
|
-
return run_main(apply_mod, ["--
|
|
562
|
+
return run_main(apply_mod, ["--input", path,
|
|
563
563
|
"--routing-email", email])
|
|
564
564
|
|
|
565
565
|
def test_no_case_owner(self):
|
|
@@ -606,7 +606,7 @@ class OptionalToggleBehavior(unittest.TestCase):
|
|
|
606
606
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
607
607
|
path = write_input(d, src)
|
|
608
608
|
summary = run_main(apply_mod, [
|
|
609
|
-
"--
|
|
609
|
+
"--input", path,
|
|
610
610
|
"--routing-email", "support@acme.com"])
|
|
611
611
|
e2c = org.state["emailToCase"]
|
|
612
612
|
for t in DEFAULT_E2C_TOGGLES:
|
|
@@ -638,7 +638,7 @@ class OptionalToggleBehavior(unittest.TestCase):
|
|
|
638
638
|
caseOrigin="Email", casePriority="Medium").build())
|
|
639
639
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
640
640
|
path = write_input(d, src)
|
|
641
|
-
summary = run_main(apply_mod, ["--
|
|
641
|
+
summary = run_main(apply_mod, ["--input", path,
|
|
642
642
|
"--routing-email", "support@acme.com"])
|
|
643
643
|
# (a) the skill did not claim to set the opted-out fields
|
|
644
644
|
self.assertNotIn("emailToCase.showWordCountInComposer",
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
"""Contract tests for the dispatch-facing surface of apply-casesettings.py: the
|
|
2
|
+
requests it tells the agent to make, the response shapes it must parse, and the
|
|
3
|
+
guarantee that it never touches the network or the sf CLI itself.
|
|
4
|
+
"""
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
import ast
|
|
8
|
+
import io
|
|
9
|
+
import json
|
|
10
|
+
import tempfile
|
|
11
|
+
import unittest
|
|
12
|
+
from contextlib import redirect_stdout
|
|
13
|
+
from pathlib import Path
|
|
14
|
+
|
|
15
|
+
from . import _bootstrap
|
|
16
|
+
from ._fakeorg import FakeOrg
|
|
17
|
+
from ._run import Input, run_main, write_input
|
|
18
|
+
|
|
19
|
+
apply_mod = _bootstrap.load_apply()
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def _save(tmp, name, data):
|
|
23
|
+
path = Path(tmp) / name
|
|
24
|
+
path.write_text(json.dumps(data), encoding="utf-8")
|
|
25
|
+
return str(path)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class NoDirectOrgAccess(unittest.TestCase):
|
|
29
|
+
def test_script_imports_no_network_or_process_modules(self):
|
|
30
|
+
tree = ast.parse(Path(apply_mod.__file__).read_text(encoding="utf-8"))
|
|
31
|
+
imported = set()
|
|
32
|
+
for node in ast.walk(tree):
|
|
33
|
+
if isinstance(node, ast.Import):
|
|
34
|
+
imported |= {n.name.split(".")[0] for n in node.names}
|
|
35
|
+
elif isinstance(node, ast.ImportFrom):
|
|
36
|
+
imported.add((node.module or "").split(".")[0])
|
|
37
|
+
self.assertFalse(imported & {"subprocess", "urllib", "http", "socket",
|
|
38
|
+
"requests"})
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class RequestShapes(unittest.TestCase):
|
|
42
|
+
def test_read_request_is_readonly_get_with_query_params(self):
|
|
43
|
+
req = apply_mod.settings_read_request("69.0")
|
|
44
|
+
self.assertEqual(req["tool"], "dispatch_readonly")
|
|
45
|
+
self.assertEqual(req["method"], "GET")
|
|
46
|
+
self.assertEqual(req["path"], "/services/data/v69.0/headless/metadata")
|
|
47
|
+
self.assertEqual(req["query_params"],
|
|
48
|
+
{"type": "CaseSettings", "fullName": "Case"})
|
|
49
|
+
|
|
50
|
+
def test_soql_is_in_query_params_not_the_path(self):
|
|
51
|
+
req = apply_mod.org_request("67.0")
|
|
52
|
+
self.assertEqual(req["tool"], "dispatch_readonly")
|
|
53
|
+
self.assertNotIn("?", req["path"])
|
|
54
|
+
self.assertIn("FROM Organization", req["query_params"]["q"])
|
|
55
|
+
|
|
56
|
+
def test_write_request_uses_dispatch_put_with_owned_fields_only(self):
|
|
57
|
+
import xml.etree.ElementTree as ET
|
|
58
|
+
records = ET.fromstring(
|
|
59
|
+
'<CaseSettings xmlns="http://soap.sforce.com/2006/04/metadata">'
|
|
60
|
+
"<enableCaseFeed>true</enableCaseFeed>"
|
|
61
|
+
"<enableDraftEmails>true</enableDraftEmails>"
|
|
62
|
+
"<emailToCase><enableEmailToCase>true</enableEmailToCase>"
|
|
63
|
+
"<routingAddresses><routingName>A</routingName>"
|
|
64
|
+
"<isVerified>true</isVerified></routingAddresses></emailToCase>"
|
|
65
|
+
"</CaseSettings>")
|
|
66
|
+
req = apply_mod.settings_write_request("67.0", records, "t")
|
|
67
|
+
self.assertEqual((req["tool"], req["method"]), ("dispatch", "PUT"))
|
|
68
|
+
body = req["body"]
|
|
69
|
+
self.assertEqual((body["type"], body["fullName"]),
|
|
70
|
+
("CaseSettings", "Case"))
|
|
71
|
+
self.assertNotIn("enableCaseFeed", body["xmlRep"])
|
|
72
|
+
self.assertNotIn("isVerified", body["xmlRep"])
|
|
73
|
+
self.assertIn("enableDraftEmails", body["xmlRep"])
|
|
74
|
+
|
|
75
|
+
def test_soql_values_are_escaped(self):
|
|
76
|
+
req = apply_mod.cases_request("67.0", "o'brien@x.com")
|
|
77
|
+
self.assertIn("o\\'brien@x.com", req["query_params"]["q"])
|
|
78
|
+
|
|
79
|
+
def test_lookup_queries_only_for_values_being_written(self):
|
|
80
|
+
org = FakeOrg(case_settings={
|
|
81
|
+
"fullName": "Case", "defaultCaseOwner": "a@x.com",
|
|
82
|
+
"defaultCaseOwnerType": "User", "defaultCaseUser": "a@x.com",
|
|
83
|
+
"emailToCase": {"enableEmailToCase": False}})
|
|
84
|
+
src = Input().with_default_toggles().build()
|
|
85
|
+
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
86
|
+
inp = write_input(d, src)
|
|
87
|
+
current = _save(d, "cur.json", org.dispatch(
|
|
88
|
+
apply_mod.settings_read_request("67.0")))
|
|
89
|
+
import io
|
|
90
|
+
from contextlib import redirect_stdout
|
|
91
|
+
buf = io.StringIO()
|
|
92
|
+
with redirect_stdout(buf):
|
|
93
|
+
apply_mod.main(["requests", "lookups", "--input", inp,
|
|
94
|
+
"--current", current])
|
|
95
|
+
# Support Settings are all configured and nothing new is named: no lookups.
|
|
96
|
+
self.assertEqual(json.loads(buf.getvalue())["requests"], [])
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class ResponseShapes(unittest.TestCase):
|
|
100
|
+
def test_unsupported_operation_bare_array(self):
|
|
101
|
+
body = [{"errorCode": "UNSUPPORTED_OPERATION",
|
|
102
|
+
"message": "MetadataCrud does not support READ on type: X"}]
|
|
103
|
+
msgs = apply_mod.error_messages(400, body)
|
|
104
|
+
self.assertEqual(len(msgs), 1)
|
|
105
|
+
self.assertIn("UNSUPPORTED_OPERATION", msgs[0])
|
|
106
|
+
|
|
107
|
+
def test_rule_error_results_shape(self):
|
|
108
|
+
body = {"results": [{"success": False, "errors": [
|
|
109
|
+
{"statusCode": "INVALID_FIELD", "message": "needs E2C first"}]}]}
|
|
110
|
+
self.assertEqual(apply_mod.error_messages(400, body),
|
|
111
|
+
["INVALID_FIELD: needs E2C first"])
|
|
112
|
+
|
|
113
|
+
def test_provisioning_failure_is_reported(self):
|
|
114
|
+
body = {"results": [{"success": False, "errors": [
|
|
115
|
+
{"statusCode": "UNKNOWN_EXCEPTION",
|
|
116
|
+
"message": "We couldn't save your routing address"}]}]}
|
|
117
|
+
msgs = apply_mod.error_messages(500, body)
|
|
118
|
+
self.assertIn("couldn't save your routing address", msgs[0])
|
|
119
|
+
|
|
120
|
+
def test_success_has_no_errors(self):
|
|
121
|
+
body = {"results": [{"success": True, "fullName": "Case", "errors": []}]}
|
|
122
|
+
self.assertEqual(apply_mod.error_messages(200, body), [])
|
|
123
|
+
|
|
124
|
+
def test_bare_non_2xx_without_detail_still_errors(self):
|
|
125
|
+
self.assertTrue(apply_mod.error_messages(502, {}))
|
|
126
|
+
|
|
127
|
+
def _check_write(self, envelope):
|
|
128
|
+
with tempfile.TemporaryDirectory() as d:
|
|
129
|
+
path = _save(d, "w.json", envelope)
|
|
130
|
+
with redirect_stdout(io.StringIO()):
|
|
131
|
+
apply_mod.main(["check-write", "--response", path])
|
|
132
|
+
|
|
133
|
+
def test_check_write_accepts_success(self):
|
|
134
|
+
self._check_write({"status_code": 200, "body": {"results": [
|
|
135
|
+
{"success": True, "fullName": "Case", "errors": []}]}})
|
|
136
|
+
|
|
137
|
+
def test_check_write_rejects_400_and_500(self):
|
|
138
|
+
for status in (400, 500):
|
|
139
|
+
with self.assertRaises(SystemExit):
|
|
140
|
+
self._check_write({"status_code": status, "body": {"results": [
|
|
141
|
+
{"success": False, "errors": [
|
|
142
|
+
{"statusCode": "X", "message": "boom"}]}]}})
|
|
143
|
+
|
|
144
|
+
def test_check_write_rejects_success_status_without_success_result(self):
|
|
145
|
+
with self.assertRaises(SystemExit):
|
|
146
|
+
self._check_write({"status_code": 200, "body": {"results": []}})
|
|
147
|
+
|
|
148
|
+
def test_read_failure_stops_the_flow(self):
|
|
149
|
+
org = FakeOrg(case_settings={"fullName": "Case",
|
|
150
|
+
"emailToCase": {"enableEmailToCase": False}})
|
|
151
|
+
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
152
|
+
path = _save(d, "r.json", {"status_code": 400, "body": [
|
|
153
|
+
{"errorCode": "UNSUPPORTED_OPERATION", "message": "nope"}]})
|
|
154
|
+
with self.assertRaises(SystemExit):
|
|
155
|
+
apply_mod.main(["read", "--response", path])
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
class VersionResolution(unittest.TestCase):
|
|
159
|
+
def test_default_paths_are_unversioned(self):
|
|
160
|
+
req = apply_mod.settings_read_request(None)
|
|
161
|
+
self.assertEqual(req["path"], "/services/data/headless/metadata")
|
|
162
|
+
self.assertEqual(apply_mod.org_request(None)["path"], "/services/data/query")
|
|
163
|
+
|
|
164
|
+
def test_flow_uses_dispatch_tools_only_for_writes_via_put(self):
|
|
165
|
+
org = FakeOrg(case_settings={"fullName": "Case",
|
|
166
|
+
"defaultCaseOwner": "a@x.com",
|
|
167
|
+
"defaultCaseOwnerType": "User",
|
|
168
|
+
"defaultCaseUser": "a@x.com",
|
|
169
|
+
"emailToCase": {"enableEmailToCase": False}})
|
|
170
|
+
src = Input().with_default_toggles().build()
|
|
171
|
+
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
172
|
+
run_main(apply_mod, ["--input", write_input(d, src)])
|
|
173
|
+
puts = [c for c in org.calls if c[1] == "PUT"]
|
|
174
|
+
self.assertTrue(puts)
|
|
175
|
+
self.assertTrue(all(t == "dispatch" for t, _m, _p in puts))
|
|
176
|
+
self.assertTrue(all(p.startswith("/services/data/")
|
|
177
|
+
for _t, m, p in org.calls if m != "GET"
|
|
178
|
+
or "/query" in p))
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
class SilentlyIgnoredSupportSetting(unittest.TestCase):
|
|
182
|
+
"""A 200 write that the org did not persist must fail verify."""
|
|
183
|
+
|
|
184
|
+
def _settings(self, **fields):
|
|
185
|
+
body = "".join(f"<{k}>{v}</{k}>" for k, v in fields.items())
|
|
186
|
+
xml = ('<?xml version="1.0" encoding="UTF-8"?><CaseSettings xmlns='
|
|
187
|
+
'"http://soap.sforce.com/2006/04/metadata"><emailToCase>'
|
|
188
|
+
'<enableEmailToCase>true</enableEmailToCase></emailToCase>'
|
|
189
|
+
f'{body}</CaseSettings>')
|
|
190
|
+
return {"status_code": 200, "body": {"type": "CaseSettings",
|
|
191
|
+
"fullName": "Case", "xmlRep": xml}}
|
|
192
|
+
|
|
193
|
+
def _verify(self, after_fields):
|
|
194
|
+
initial = self._settings(defaultCaseOwner="a@x.com",
|
|
195
|
+
defaultCaseOwnerType="User",
|
|
196
|
+
useSystemUserAsDefaultCaseUser="true")
|
|
197
|
+
with tempfile.TemporaryDirectory() as d:
|
|
198
|
+
files = {"initial": _save(d, "i.json", initial),
|
|
199
|
+
"after": _save(d, "a.json", self._settings(**after_fields)),
|
|
200
|
+
"users": _save(d, "u.json", {"status_code": 200, "body": {
|
|
201
|
+
"records": [{"Username": "u@x.com"}]}})}
|
|
202
|
+
src = Path(d) / "in.xml"
|
|
203
|
+
src.write_text(Input().build(), encoding="utf-8")
|
|
204
|
+
with redirect_stdout(io.StringIO()):
|
|
205
|
+
apply_mod.main(["verify", "--input", str(src),
|
|
206
|
+
"--initial", files["initial"],
|
|
207
|
+
"--after", files["after"],
|
|
208
|
+
"--users", files["users"],
|
|
209
|
+
"--overwrite-support-settings",
|
|
210
|
+
"--automated-type", "User",
|
|
211
|
+
"--automated-value", "u@x.com"])
|
|
212
|
+
|
|
213
|
+
def test_ignored_automated_user_fails(self):
|
|
214
|
+
with self.assertRaises(SystemExit):
|
|
215
|
+
self._verify({"defaultCaseOwner": "a@x.com",
|
|
216
|
+
"defaultCaseOwnerType": "User",
|
|
217
|
+
"useSystemUserAsDefaultCaseUser": "true"})
|
|
218
|
+
|
|
219
|
+
def test_persisted_automated_user_passes(self):
|
|
220
|
+
self._verify({"defaultCaseOwner": "a@x.com", "defaultCaseOwnerType": "User",
|
|
221
|
+
"defaultCaseUser": "u@x.com",
|
|
222
|
+
"useSystemUserAsDefaultCaseUser": "false"})
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
class OutlookAddress(unittest.TestCase):
|
|
226
|
+
"""Outlook addresses take no emailAddress and require a caseOwner."""
|
|
227
|
+
|
|
228
|
+
ADMIN = "admin@acme.com"
|
|
229
|
+
|
|
230
|
+
def _org(self):
|
|
231
|
+
return FakeOrg(active_users=[self.ADMIN],
|
|
232
|
+
case_settings={"fullName": "Case",
|
|
233
|
+
"defaultCaseOwner": self.ADMIN,
|
|
234
|
+
"defaultCaseOwnerType": "User",
|
|
235
|
+
"defaultCaseUser": self.ADMIN,
|
|
236
|
+
"emailToCase": {"enableEmailToCase": False}})
|
|
237
|
+
|
|
238
|
+
def _src(self, outlook_owner=True):
|
|
239
|
+
outlook = dict(addressType="Outlook", routingName="Sales Outlook",
|
|
240
|
+
caseOrigin="Email", casePriority="High")
|
|
241
|
+
if outlook_owner:
|
|
242
|
+
outlook.update(caseOwner=self.ADMIN, caseOwnerType="User")
|
|
243
|
+
return (Input().address(addressType="EmailToCase", routingName="Support",
|
|
244
|
+
caseOrigin="Email", casePriority="Medium")
|
|
245
|
+
.address(**outlook).build())
|
|
246
|
+
|
|
247
|
+
def test_email_goes_to_the_email_address_only(self):
|
|
248
|
+
org = self._org()
|
|
249
|
+
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
250
|
+
summary = run_main(apply_mod, ["--input", write_input(d, self._src()),
|
|
251
|
+
"--routing-email", "a@acme.com"])
|
|
252
|
+
addrs = org.state["emailToCase"]["routingAddresses"]
|
|
253
|
+
by_type = {a["addressType"]: a for a in addrs}
|
|
254
|
+
self.assertEqual(by_type["EmailToCase"]["emailAddress"], "a@acme.com")
|
|
255
|
+
self.assertNotIn("emailAddress", by_type["Outlook"])
|
|
256
|
+
self.assertEqual(summary["verified"]["routingAddressCount"], 2)
|
|
257
|
+
|
|
258
|
+
def test_outlook_without_owner_fails_before_any_write(self):
|
|
259
|
+
org = self._org()
|
|
260
|
+
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
261
|
+
with self.assertRaises(SystemExit):
|
|
262
|
+
run_main(apply_mod, ["--input",
|
|
263
|
+
write_input(d, self._src(outlook_owner=False)),
|
|
264
|
+
"--routing-email", "a@acme.com"])
|
|
265
|
+
self.assertEqual(org.writes, [])
|
|
266
|
+
|
|
267
|
+
def test_email_count_ignores_outlook(self):
|
|
268
|
+
org = self._org()
|
|
269
|
+
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
270
|
+
with self.assertRaises(SystemExit):
|
|
271
|
+
run_main(apply_mod, ["--input", write_input(d, self._src()),
|
|
272
|
+
"--routing-email", "a@acme.com",
|
|
273
|
+
"--routing-email", "b@acme.com"])
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
class PhaseBNeedsAFreshRead(unittest.TestCase):
|
|
277
|
+
"""Phase B writes back the record it is given, so a read taken before Phase A
|
|
278
|
+
landed must be refused rather than reverting Phase A's toggles."""
|
|
279
|
+
|
|
280
|
+
def _phase_b(self, org, tmp, src):
|
|
281
|
+
input_path = Path(tmp) / "source.xml"
|
|
282
|
+
input_path.write_text(src, encoding="utf-8")
|
|
283
|
+
read = org.dispatch(apply_mod.settings_read_request("69.0"))
|
|
284
|
+
current = _save(tmp, "current.json", read)
|
|
285
|
+
return ["phase-b", "--input", str(input_path), "--current", current,
|
|
286
|
+
"--routing-email", "support@acme.com"]
|
|
287
|
+
|
|
288
|
+
def _src(self):
|
|
289
|
+
return (Input().with_default_toggles()
|
|
290
|
+
.address(addressType="EmailToCase", routingName="Support",
|
|
291
|
+
caseOrigin="Email", casePriority="Medium").build())
|
|
292
|
+
|
|
293
|
+
def test_a_read_from_before_phase_a_is_refused(self):
|
|
294
|
+
org = FakeOrg(case_settings={"fullName": "Case",
|
|
295
|
+
"emailToCase": {"enableEmailToCase": False}})
|
|
296
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
297
|
+
argv = self._phase_b(org, tmp, self._src())
|
|
298
|
+
with self.assertRaises(SystemExit):
|
|
299
|
+
apply_mod.main(argv)
|
|
300
|
+
self.assertEqual(org.writes, [])
|
|
301
|
+
|
|
302
|
+
def test_a_read_taken_after_phase_a_is_accepted(self):
|
|
303
|
+
org = FakeOrg(case_settings={
|
|
304
|
+
"fullName": "Case",
|
|
305
|
+
"emailToCase": {"enableEmailToCase": True,
|
|
306
|
+
"enableOnDemandEmailToCase": True}})
|
|
307
|
+
with tempfile.TemporaryDirectory() as tmp:
|
|
308
|
+
argv = self._phase_b(org, tmp, self._src())
|
|
309
|
+
buf = io.StringIO()
|
|
310
|
+
with redirect_stdout(buf):
|
|
311
|
+
apply_mod.main(argv)
|
|
312
|
+
self.assertIn("request", json.loads(buf.getvalue()))
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
if __name__ == "__main__":
|
|
316
|
+
unittest.main()
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"""Tests for the three capabilities added for the Email-to-Case steel thread:
|
|
2
2
|
|
|
3
|
-
1. Production-org safety gate (
|
|
4
|
-
2. API
|
|
5
|
-
3. Act-3 verify-cases proof step (
|
|
3
|
+
1. Production-org safety gate (the `gate` subcommand / --confirm-production).
|
|
4
|
+
2. (removed: dispatch cannot list API versions; the default is pinned.)
|
|
5
|
+
3. Act-3 verify-cases proof step (the `cases` subcommand).
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The agent's dispatch loop runs against FakeOrg — no live org required.
|
|
8
8
|
"""
|
|
9
9
|
from __future__ import annotations
|
|
10
10
|
|
|
@@ -40,46 +40,14 @@ def _apply(org, extra_argv, addr=True):
|
|
|
40
40
|
src = b.build()
|
|
41
41
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
42
42
|
path = write_input(d, src)
|
|
43
|
-
argv = ["--
|
|
43
|
+
argv = ["--input", path]
|
|
44
44
|
if addr:
|
|
45
45
|
argv += ["--routing-email", "support@acme.com"]
|
|
46
46
|
return run_main(apply_mod, argv + extra_argv)
|
|
47
47
|
|
|
48
48
|
|
|
49
|
-
class ApiVersionDerivation(unittest.TestCase):
|
|
50
|
-
"""resolve_api_version: floor at DEFAULT_API_VERSION, ride newer orgs."""
|
|
51
|
-
|
|
52
|
-
def test_floors_below_default(self):
|
|
53
|
-
self.assertEqual(apply_mod.resolve_api_version("62.0"), "67.0")
|
|
54
|
-
|
|
55
|
-
def test_equal_to_floor(self):
|
|
56
|
-
self.assertEqual(apply_mod.resolve_api_version("67.0"), "67.0")
|
|
57
|
-
|
|
58
|
-
def test_rides_newer_org(self):
|
|
59
|
-
self.assertEqual(apply_mod.resolve_api_version("68.0"), "68.0")
|
|
60
|
-
|
|
61
|
-
def test_rides_much_newer_org(self):
|
|
62
|
-
self.assertEqual(apply_mod.resolve_api_version("70.0"), "70.0")
|
|
63
|
-
|
|
64
|
-
def test_none_falls_back_to_floor(self):
|
|
65
|
-
self.assertEqual(apply_mod.resolve_api_version(None), "67.0")
|
|
66
|
-
|
|
67
|
-
def test_garbage_falls_back_to_floor(self):
|
|
68
|
-
self.assertEqual(apply_mod.resolve_api_version("not-a-version"), "67.0")
|
|
69
|
-
|
|
70
|
-
def test_summary_reports_derived_version(self):
|
|
71
|
-
org = _fresh(org_api_version="70.0")
|
|
72
|
-
summary = _apply(org, [])
|
|
73
|
-
self.assertEqual(summary["apiVersion"], "70.0")
|
|
74
|
-
|
|
75
|
-
def test_summary_reports_floored_version(self):
|
|
76
|
-
org = _fresh(org_api_version="60.0")
|
|
77
|
-
summary = _apply(org, [])
|
|
78
|
-
self.assertEqual(summary["apiVersion"], "67.0")
|
|
79
|
-
|
|
80
|
-
|
|
81
49
|
class ProductionGate(unittest.TestCase):
|
|
82
|
-
"""
|
|
50
|
+
"""gate: block prod writes unless --confirm-production."""
|
|
83
51
|
|
|
84
52
|
def test_sandbox_writes_without_confirmation(self):
|
|
85
53
|
org = _fresh(is_sandbox=True)
|
|
@@ -114,14 +82,15 @@ class ProductionGate(unittest.TestCase):
|
|
|
114
82
|
_apply(org, [])
|
|
115
83
|
self.assertEqual(org.writes, [])
|
|
116
84
|
|
|
117
|
-
def
|
|
85
|
+
def test_unreadable_org_row_blocked_even_with_confirmation(self):
|
|
118
86
|
org = _fresh(is_sandbox=None)
|
|
119
|
-
|
|
120
|
-
|
|
87
|
+
with self.assertRaises(SystemExit):
|
|
88
|
+
_apply(org, ["--confirm-production"])
|
|
89
|
+
self.assertEqual(org.writes, [])
|
|
121
90
|
|
|
122
91
|
|
|
123
92
|
class VerifyCasesMode(unittest.TestCase):
|
|
124
|
-
"""
|
|
93
|
+
"""cases: proof requires an Email-origin Case with a
|
|
125
94
|
linked incoming EmailMessage."""
|
|
126
95
|
|
|
127
96
|
def _run_verify(self, org, extra=None):
|
|
@@ -130,7 +99,7 @@ class VerifyCasesMode(unittest.TestCase):
|
|
|
130
99
|
src = Input().with_default_toggles().build()
|
|
131
100
|
with tempfile.TemporaryDirectory() as d, org.patch(apply_mod):
|
|
132
101
|
path = write_input(d, src)
|
|
133
|
-
return run_main(apply_mod, ["--
|
|
102
|
+
return run_main(apply_mod, ["--input", path,
|
|
134
103
|
"--verify-cases", *(extra or [])])
|
|
135
104
|
|
|
136
105
|
def test_proven_when_case_and_incoming_message(self):
|
|
@@ -99,6 +99,19 @@ class RoutingAddressRules(unittest.TestCase):
|
|
|
99
99
|
def test_no_routing_address_flagged(self):
|
|
100
100
|
self.assertTrue(_has(_errors(Input().build()), "No <routingAddresses> found"))
|
|
101
101
|
|
|
102
|
+
def test_no_routing_address_allowed_only_when_opted_in(self):
|
|
103
|
+
with tempfile.TemporaryDirectory() as d:
|
|
104
|
+
path = write_input(d, Input().build())
|
|
105
|
+
self.assertEqual(validate_mod.validate(path, allow_no_addresses=True), [])
|
|
106
|
+
self.assertTrue(_has(validate_mod.validate(path), "No <routingAddresses> found"))
|
|
107
|
+
|
|
108
|
+
def test_opt_in_does_not_relax_other_rules(self):
|
|
109
|
+
xml = Input().build().replace("<enableOnDemandEmailToCase>true", "<enableOnDemandEmailToCase>false")
|
|
110
|
+
with tempfile.TemporaryDirectory() as d:
|
|
111
|
+
path = write_input(d, xml)
|
|
112
|
+
self.assertTrue(_has(validate_mod.validate(path, allow_no_addresses=True),
|
|
113
|
+
"enableOnDemandEmailToCase"))
|
|
114
|
+
|
|
102
115
|
def test_missing_required_address_field(self):
|
|
103
116
|
# routingName omitted
|
|
104
117
|
xml = Input().address(addressType="EmailToCase", caseOrigin="Email",
|
|
@@ -20,7 +20,11 @@ Checks structural rules that must hold before applying:
|
|
|
20
20
|
- Read-only fields (emailServicesAddress, isVerified) are not set.
|
|
21
21
|
- Enum values for overEmailLimitAction / unauthorizedSenderAction are valid.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
A source file with no routingAddresses is an error unless --no-addresses-ok is
|
|
24
|
+
passed; that flag is for a run that only changes toggles on an org that already
|
|
25
|
+
has its addresses.
|
|
26
|
+
|
|
27
|
+
Usage: python3 validate-casesettings.py [--no-addresses-ok] <path-to-file> (--help for this text)
|
|
24
28
|
Exits non-zero and prints ERROR lines to stderr if any check fails.
|
|
25
29
|
"""
|
|
26
30
|
import sys
|
|
@@ -59,7 +63,7 @@ def is_placeholder(value):
|
|
|
59
63
|
return bool(value) and value.startswith("{") and value.endswith("}")
|
|
60
64
|
|
|
61
65
|
|
|
62
|
-
def validate(path):
|
|
66
|
+
def validate(path, allow_no_addresses=False):
|
|
63
67
|
errors = []
|
|
64
68
|
try:
|
|
65
69
|
tree = ET.parse(path)
|
|
@@ -145,7 +149,7 @@ def validate(path):
|
|
|
145
149
|
errors.append(f"unauthorizedSenderAction must be one of {sorted(UNAUTHORIZED_ACTIONS)}, found '{unauth}'.")
|
|
146
150
|
|
|
147
151
|
addresses = e2c.findall(f"{Q}routingAddresses")
|
|
148
|
-
if not addresses:
|
|
152
|
+
if not addresses and not allow_no_addresses:
|
|
149
153
|
errors.append("No <routingAddresses> found — at least one is expected.")
|
|
150
154
|
seen_names = set()
|
|
151
155
|
for i, addr in enumerate(addresses, 1):
|
|
@@ -180,6 +184,10 @@ def validate(path):
|
|
|
180
184
|
# valid caseOwnerType — the platform rejects caseOwner without a type.
|
|
181
185
|
case_owner = child_text(addr, "caseOwner")
|
|
182
186
|
case_owner_type = child_text(addr, "caseOwnerType")
|
|
187
|
+
if atype == "Outlook" and case_owner is None:
|
|
188
|
+
errors.append(
|
|
189
|
+
f"{label} is an Outlook address, which requires caseOwner and "
|
|
190
|
+
"caseOwnerType — the platform rejects it with 'Missing caseOwner'.")
|
|
183
191
|
if case_owner is not None:
|
|
184
192
|
if is_placeholder(case_owner):
|
|
185
193
|
errors.append(
|
|
@@ -211,12 +219,16 @@ def validate(path):
|
|
|
211
219
|
|
|
212
220
|
|
|
213
221
|
def main():
|
|
214
|
-
|
|
222
|
+
allow_none = "--no-addresses-ok" in sys.argv
|
|
223
|
+
args = [a for a in sys.argv[1:] if a not in ("--help", "-h", "--no-addresses-ok")]
|
|
215
224
|
if len(sys.argv) == 1 or "--help" in sys.argv or "-h" in sys.argv:
|
|
216
225
|
print(__doc__)
|
|
217
226
|
return 0 if "--help" in sys.argv or "-h" in sys.argv else 2
|
|
227
|
+
if not args:
|
|
228
|
+
print(__doc__)
|
|
229
|
+
return 2
|
|
218
230
|
path = args[0]
|
|
219
|
-
errors = validate(path)
|
|
231
|
+
errors = validate(path, allow_no_addresses=allow_none)
|
|
220
232
|
if errors:
|
|
221
233
|
for e in errors:
|
|
222
234
|
print(f"ERROR: {e}", file=sys.stderr)
|