Files
Investidor-V2/outputs/investmoz-editorial-QA-20261018/finish-prefill.py
T
nala cf003c8623
tests / ci (push) Canceled after 0s
versao nrgocios 4
2026-10-18 15:57:06 +02:00

12 lines
1.5 KiB
Python

from pathlib import Path
scope={'__file__':str(Path(__file__).parent/'test-QA.py')};exec((Path(__file__).parent/'test-QA.py').read_text('utf8').split('try:\n a=login')[0],scope);globals().update(scope)
old=json.loads((o/'PROVAS-PREENCHIMENTO-QA.json').read_text('utf8'));checks.extend(c for c in old['checks'] if c['resultado']=='observado')
try:
a=login('authorized');v=session();state=props(a,'/management/portal-services');r=next(r for r in state['resources'] if r['title']=='Artigo legado sintético QA');d=next(d for d in state['documents'] if d['id']==r['document_id'])
call(v,'/documentos/'+str(r['id'])+'/download');ck('Original estruturado não sobrescrito',events[-1]['response_sha256']==d['sha256'],{'resource_id':r['id'],'original_sha256':d['sha256']})
call(v,'/sectores/sector-editorial-qa',expected=404);ck('Ligação direta de novo sector retirado não divulga rascunho',True)
except Exception as e:checks.append({'criterio':'Delta de recuperação restante','resultado':'falhou','evidencia':str(e)})
finally:
(o/'PROVAS-PREENCHIMENTO-primeira-execucao.json').write_text(json.dumps(old,ensure_ascii=False,indent=2),'utf8')
(o/'PROVAS-PREENCHIMENTO-QA.json').write_text(json.dumps({'checks':checks,'events':old['events']+events,'active_changes':0,'correction':'Download JSON was decoded by test helper; raw response hash now used. No product change or repeated upload.'},ensure_ascii=False,indent=2),'utf8');print(json.dumps({'checks':len(checks),'failed':[c for c in checks if c['resultado']=='falhou']},ensure_ascii=True))