fix: adapt autotest to updated service APIs
This commit is contained in:
@@ -21,3 +21,44 @@ def test_scenario_name_escape_chain_includes_amp_backslash_quote_doublequote():
|
||||
".replace(/\"/g,'"');"
|
||||
)
|
||||
assert expected in content
|
||||
|
||||
|
||||
def test_scenario_editor_loads_operations_from_selected_service():
|
||||
js_path = Path(__file__).resolve().parents[1] / "site" / "static" / "js" / "scenario-form.js"
|
||||
content = js_path.read_text(encoding="utf-8")
|
||||
|
||||
assert "async function loadServiceOperations(svcId)" in content
|
||||
assert "fetch('/api/operations/' + svcId)" in content
|
||||
assert "serviceOps.filter(item => item.operation !== 'reconcile')" in content
|
||||
assert "const allOps = ['create', 'delete', 'modify', 'suspend', 'resume', 'redeploy']" not in content
|
||||
|
||||
|
||||
def test_manual_create_uses_current_service_operation_id():
|
||||
js_path = Path(__file__).resolve().parents[1] / "site" / "static" / "js" / "operations.js"
|
||||
content = js_path.read_text(encoding="utf-8")
|
||||
|
||||
assert "find(o => o.operation === 'create')" in content
|
||||
assert "showParams(createOp.svcOperationId, 'create')" in content
|
||||
assert "showParams(18, 'create')" not in content
|
||||
|
||||
|
||||
def test_scenario_editor_preserves_legacy_and_cloud_instance_references():
|
||||
js_path = Path(__file__).resolve().parents[1] / "site" / "static" / "js" / "scenario-form.js"
|
||||
content = js_path.read_text(encoding="utf-8")
|
||||
|
||||
assert "_legacyInstanceFallback: s.operation !== 'create'" in content
|
||||
assert "_showCloud: Boolean(s.instance_uid)" in content
|
||||
assert "ref === step.instance_uid" in content
|
||||
assert "s.instance_uid = ref" in content
|
||||
assert "&& !scenarioEditorState.steps[i]._legacyInstanceFallback" in content
|
||||
|
||||
|
||||
def test_live_scripts_are_not_collected_as_network_tests():
|
||||
tests_dir = Path(__file__).resolve().parent
|
||||
user_simulation = (tests_dir / "test_user_simulation.py").read_text(encoding="utf-8")
|
||||
smoke = (tests_dir / "test_smoke_all_services.py").read_text(encoding="utf-8")
|
||||
|
||||
assert "pytest.skip(" in user_simulation
|
||||
assert "pytestmark = pytest.mark.skip" in smoke
|
||||
assert "operation_id(sid, \"create\"" in user_simulation
|
||||
assert "create_op[\"svcOperationId\"]" in smoke
|
||||
|
||||
Reference in New Issue
Block a user