|
1 | 1 | """Installed CommonJS connected-shadow protocol with an offline typed transport.""" |
2 | 2 | from __future__ import annotations |
3 | 3 |
|
| 4 | +from datetime import datetime, timedelta, timezone |
4 | 5 | import hashlib |
5 | 6 | import json |
6 | 7 | import os |
|
32 | 33 | ) |
33 | 34 |
|
34 | 35 |
|
| 36 | +def _utc(offset: timedelta) -> str: |
| 37 | + """Fixture grant and scope times relative to this run, never a fixed date.""" |
| 38 | + return (datetime.now(timezone.utc) + offset).strftime('%Y-%m-%dT%H:%M:%SZ') |
| 39 | + |
| 40 | + |
35 | 41 | PROJECT = Path(__file__).resolve().parents[1] |
36 | 42 |
|
37 | 43 |
|
@@ -224,7 +230,7 @@ def invoke(*args, ok=True): |
224 | 230 | grant = {'core_sha256': digest(core), 'mode': 'shadow', |
225 | 231 | 'endpoint': request['endpoint'], 'credential_ref': request['credential_ref'], |
226 | 232 | 'model': request['model'], 'environment_digest': env_digest, |
227 | | - 'issued_at': '2026-09-28T00:00:00Z', 'expires_at': '2026-10-01T00:00:00Z'} |
| 233 | + 'issued_at': _utc(timedelta(days=-1)), 'expires_at': _utc(timedelta(days=1))} |
228 | 234 | request['egress_grant'] = grant |
229 | 235 | request_file = tmp_path / 'connected-request.json' |
230 | 236 | request_file.write_text(json.dumps(request), encoding='utf-8') |
@@ -263,7 +269,7 @@ def invoke(*args, ok=True): |
263 | 269 | 'reference': 'offline-connected-fixture', 'run_id': created_status['run_id'], |
264 | 270 | 'plan_sha256': descriptor['descriptor_sha256'], |
265 | 271 | 'trusted_session_head': created_status['session_head_sha256'], |
266 | | - 'expires_at': '2026-10-01T00:00:00Z', 'revoked': False, |
| 272 | + 'expires_at': _utc(timedelta(days=1)), 'revoked': False, |
267 | 273 | 'grants': {'launch': True, 'stop': True, 'disable': True, |
268 | 274 | 'rollback': False, 'upgrade': False}} |
269 | 275 | scope['scope_sha256'] = digest(scope) |
|
0 commit comments