Dry run publish 1C access profiles
This commit is contained in:
@@ -1466,7 +1466,7 @@ def test_runtime_required_import_does_not_index_cf_file_directly(monkeypatch, tm
|
||||
assert payload["normalized_summary"]["object_count"] >= 1
|
||||
|
||||
|
||||
def test_import_supports_structure_only_indexing(tmp_path: Path):
|
||||
def test_import_supports_structure_only_indexing(monkeypatch, tmp_path: Path):
|
||||
(tmp_path / "metadata.xml").write_text(
|
||||
"""
|
||||
<Configuration>
|
||||
@@ -1585,6 +1585,31 @@ def test_import_supports_structure_only_indexing(tmp_path: Path):
|
||||
assert any(item["action"] == "ADD_ROLE_TO_PROFILE" and item["role"] == "Роль.Менеджер" for item in plan_payload["operations"])
|
||||
assert plan_payload["extension_payload"]["operation"] == "access.profile.apply"
|
||||
|
||||
captured_extension_call = {}
|
||||
|
||||
def fake_extension_call(project_id_arg, settings_arg, request_arg):
|
||||
captured_extension_call["project_id"] = project_id_arg
|
||||
captured_extension_call["request"] = request_arg
|
||||
return main.SferaExtensionCallResponse(
|
||||
project_id=project_id_arg,
|
||||
operation=request_arg.operation,
|
||||
status="READY",
|
||||
ready=True,
|
||||
dry_run=request_arg.dry_run,
|
||||
extension_url="http://example.test/hs/sfera/v1/metadata/apply",
|
||||
result={"status": "dry_run", "operation": request_arg.operation},
|
||||
)
|
||||
|
||||
monkeypatch.setattr(main, "_call_sfera_extension", fake_extension_call)
|
||||
publish_dry_run = client.post(
|
||||
f"/projects/{project_id}/access/profiles/{quote('НовыйПрофильHTTP')}/publish-dry-run"
|
||||
)
|
||||
assert publish_dry_run.status_code == 200
|
||||
assert publish_dry_run.json()["operation"] == "access.profile.apply"
|
||||
assert captured_extension_call["project_id"] == project_id
|
||||
assert captured_extension_call["request"].dry_run is True
|
||||
assert captured_extension_call["request"].payload["profile"]["roles"] == ["Роль.Менеджер"]
|
||||
|
||||
tree = client.get(f"/projects/{project_id}/metadata/tree")
|
||||
assert tree.status_code == 200
|
||||
root = tree.json()["root"]
|
||||
|
||||
Reference in New Issue
Block a user