@@ -0,0 +1,48 @@
|
||||
"""Real authenticated no-op on an already used 040000 QA schema; no destructive reinstall."""
|
||||
import json
|
||||
import uuid
|
||||
from datetime import datetime, timezone
|
||||
from portal_profiles_http_session import Session, PRIVATE, EXPECTED, REASON, events
|
||||
|
||||
proof = {'target': EXPECTED, 'started_at': datetime.now(timezone.utc).isoformat(), 'active_writes': 0, 'interface_observed': False}
|
||||
try:
|
||||
holder = Session('super_first').login()
|
||||
plan = holder.call('GET', '/management/profile-install')
|
||||
proof['code_hash'] = plan['code_hash']
|
||||
assert plan['installed'] and plan['consistent'] and plan['bootstrap']['initialized']
|
||||
assert all(plan['dependencies'].values()) and plan['path_190000_installed']
|
||||
data = {'hash': plan['hash'], 'confirm': True, 'idempotency_key': str(uuid.uuid4()), 'reason': REASON}
|
||||
result = holder.call('POST', '/management/profile-install', data)
|
||||
assert result['installed'] and not result['changed'] and not result['flags_changed']
|
||||
assert holder.call('POST', '/management/profile-install', data) == result
|
||||
holder.call('POST', '/management/profile-install', {**data, 'reason': REASON + ' changed'}, status=409)
|
||||
fresh = Session('super_first').login()
|
||||
recovered = fresh.call('GET', '/management/profile-install')
|
||||
assert recovered['installed'] and recovered['bootstrap'] == plan['bootstrap']
|
||||
for role in ['promoter', 'auditor', 'outsider']:
|
||||
denied = Session(role).login()
|
||||
denied.call('GET', '/management/profile-install', status=403)
|
||||
denied.call('POST', '/management/profile-install', data, status=403)
|
||||
fresh.call('POST', '/management/profile-install/bootstrap', {**data, 'hash': recovered['hash'], 'idempotency_key': str(uuid.uuid4()),
|
||||
'first_user_id': recovered['bootstrap']['holders'][0], 'second_user_id': recovered['bootstrap']['holders'][1]}, status=409)
|
||||
promoter = Session('promoter').login()
|
||||
source = json.loads((PRIVATE / 'opportunity-semantic-http-qa.json').read_text(encoding='utf-8-sig'))
|
||||
labels = []
|
||||
for category in ['investment_project', 'business_sale', 'land_rights']:
|
||||
case = next(c for c in source['cases'] if c['category'] == category)
|
||||
page = promoter.call('GET', f"/minhas-oportunidades/{case['id']}/view", inertia=True)['props']
|
||||
labels.append({'id': case['id'], 'category': category, 'publication': page['publicationState'], 'working_state': page['workflowState']})
|
||||
assert labels[0]['publication']['scope'] == 'restricted' and not labels[0]['publication']['public_catalog']
|
||||
assert labels[1]['publication']['scope'] == 'public' and labels[1]['publication']['public_catalog']
|
||||
assert labels[2]['publication']['scope'] == 'unpublished' and labels[2]['working_state'] == 'approved'
|
||||
proof.update({'result': 'passed', 'ready': recovered['ready'], 'installed': True, 'changed': False, 'idempotency_verified': True,
|
||||
'new_session_recovery': True, 'denied_profiles': [21, 26, 23], 'existing_pair_unchanged': True, 'bootstrap_existing_pair': 409,
|
||||
'publication_labels': labels, 'cold_install_scope': 'Separate isolated HTTP feature tests; live QA schema is already in use and was not removed.'})
|
||||
except Exception as error:
|
||||
proof.update({'result': 'failed', 'failure': str(error)})
|
||||
raise
|
||||
finally:
|
||||
proof['events'] = events
|
||||
proof['completed_at'] = datetime.now(timezone.utc).isoformat()
|
||||
(PRIVATE / 'profile-installation-http-qa.json').write_text(json.dumps(proof, ensure_ascii=False, indent=2), encoding='utf-8')
|
||||
print(json.dumps({'result': proof['result'], 'target': EXPECTED, 'installed': True, 'no_op': True, 'events': len(events), 'interface_observed': False, 'active_writes': 0}))
|
||||
Reference in New Issue
Block a user