21 lines
2.8 KiB
Python
21 lines
2.8 KiB
Python
from http_common import *
|
|
owner=login('owner');outsider=login('outsider');anon=session();top='0ae14c9a-1adb-4ee7-8094-d5d54d4e75f1';case='ff0e2468-5eae-4556-8c74-97ade0b0b079'
|
|
start=f'/investimentos/a-partir-do-parque/{top}?consulted_public_version=5'
|
|
call(anon,start,expected=401);check('zone_entry_requires_normal_login',True)
|
|
source=call(owner,start)['zoneSource'];check('consulted_context_reference_only',source['zone_id']==top and source['consulted_public_version']==5 and 'não constitui reserva' in source['notice'])
|
|
before=call(owner,'/investimentos/'+case);data={'zone_id':top,'consulted_public_version':5,'version':before['case']['version'],'confirm':True}
|
|
call(owner,f'/investimentos/{case}/parques',{**data,'confirm':False},expected=422)
|
|
call(outsider,f'/investimentos/{case}/parques',data,expected=403)
|
|
call(owner,f'/investimentos/{case}/parques',data)
|
|
after=call(owner,'/investimentos/'+case);check('existing_dossier_UUID_public_version_recovered',len(after['zone_contexts'])==1 and after['zone_contexts'][0]['zone_id']==top and after['zone_contexts'][0]['consulted_public_version']==5)
|
|
for field in ['content_sources','sector_contexts','facts','documents','requests','journey_id','definition_id']:check('prior_context_preserved_'+field,after[field]==before[field])
|
|
call(owner,f'/investimentos/{case}/parques',data);same=call(owner,'/investimentos/'+case);check('same_zone_version_attach_idempotent',same['case']['version']==after['case']['version'] and same['zone_contexts']==after['zone_contexts'])
|
|
fresh=login('owner');check('new_session_recovers_consulted_version',call(fresh,'/investimentos/'+case)['zone_contexts']==after['zone_contexts'])
|
|
newdata={'title':'SIMULAÇÃO QA — referência de parque, sem reserva','client_key':str(uuid.uuid4()),'reuse_consent':True,'zone_id':top,'consulted_public_version':5,'confirm':True}
|
|
new=call(fresh,'/investimentos',newdata,expected=201);view=call(fresh,'/investimentos/'+new['id']);check('new_idea_same_existing_journey_contract',len(view['steps'])==19 and view['zone_contexts'][0]['consulted_public_version']==5)
|
|
repeated=call(fresh,'/investimentos',newdata,expected=201);check('create_normal_key_reuses_same_case',repeated['id']==new['id'])
|
|
state={'existing_case':case,'new_case':new['id'],'reference':after['zone_contexts'],'existing_view_before':before,'existing_view_after':after}
|
|
(private/'context-proof-private.json').write_text(json.dumps(state,ensure_ascii=False),'utf-8')
|
|
(out/'CONTEXTO-QA.json').write_text(json.dumps({'existing_case':case,'new_case':new['id'],'reference':after['zone_contexts'],'no_reservation_or_installation':True,'support':'Uses the existing dossier service chooser; no support request submitted'},ensure_ascii=False,indent=2),'utf-8')
|
|
print(json.dumps({'checks':len(proof['checks']),'events':len(proof['events']),'phase':'context complete'}))
|