"""Read-only Scripts dialog boundaries; supplemental to rendered behavior tests.""" import hashlib,json,subprocess from pathlib import Path root=Path(__file__).resolve().parent while not list(root.glob('*.slnx')): if root.parent==root:raise RuntimeError('Repository root not found') root=root.parent baseline='ea5bb6a0bc54844851b2ee6d0a165ebf53479c88';page='src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Pages/Scripts.razor' def old(path):return subprocess.check_output(['git','show',baseline+':'+path],cwd=root) source=(root/page).read_text();prior=old(page).decode() checks={ 'listMarkupExact':prior.split('@* The dialog')[0]==source.replace('@implements IDisposable\n','').split('@* The dialog')[0], 'authorizationRouteRenderModeExact':all(x in source for x in ['@page "/scripts"','@attribute [Authorize(Policy = AdminUiPolicies.ConfigEditor)]','@rendermode RenderMode.InteractiveServer']), 'lazyProjectionAndReadCallsPreserved':all(source.count(x)==prior.count(x)==1 for x in ['ScriptListQueries.LoadRowsAsync(db)','ScriptListQueries.LoadSourceAsync(db, scriptId)']), 'currentErrorFormatPreserved':'$"The script source could not be loaded: {ex.Message}"' in source, 'sourceStillEncodedRazorText':'@_sourceCode' in source and 'MarkupString' not in source, 'readOnlyNoEntityMutation':not any(x in source for x in ['SaveChanges','AddAsync(','Remove(','Update(']), 'originalLargeScrollableGeometry':'DialogClass="modal-lg modal-dialog-scrollable"' in source, 'noInventedEditorOrFields':not any(x in source for x in ['