Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update payload to v2 layout to run daily benchmark #154

Merged
merged 5 commits into from
Apr 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 46 additions & 17 deletions runner_benchmark/token_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,51 @@

KEYS_FOLDER = './jwt-test-keys'

TOP_LEVEL_METADATA_KEYS = [
"exp",
"jti",
"iat",
"tx_id",
"account_service_url",
"case_id",
"collection_exercise_sid",
"response_id",
"response_expires_at",
"language_code",
"schema_name",
"schema_url",
"cir_instrument_id",
"channel",
"region_code",
"roles",
]

PAYLOAD = {
'user_id': 'benchmark-user',
'period_str': 'July 2019',
'period_id': '201907',
'collection_exercise_sid': str(uuid4()),
'version': 'v2',
'account_service_url': 'http://upstream.url',
'case_id': str(uuid4()),
'case_type': 'HI',
'display_address': '68 Abingdon Road, Goathill',
'ru_ref': '123456789012A',
'ru_name': 'Integration Testing',
'ref_p_start_date': '2019-04-01',
'ref_p_end_date': '2019-11-30',
'return_by': '2019-12-06',
'trad_as': 'Benchmark Tests',
'employment_date': '1983-06-02',
'region_code': 'GB-ENG',
'collection_exercise_sid': str(uuid4()),
'response_id': str(uuid4()),
'language_code': 'en',
'region_code': 'GB-ENG',
'roles': [],
'account_service_url': 'http://upstream.url',
'variant_flags': {'sexual_identity': 'false'},
'survey_metadata': {
'data': {
'case_ref': '1000000000000001',
'form_type': '0001',
'period_id': '201907',
'period_str': 'July 2019',
'ref_p_start_date': '2019-04-01',
'ref_p_end_date': '2019-11-30',
'ru_name': 'Benchmark Testing',
'ru_ref': '123456789012A',
'trad_as': 'Benchmark Tests',
'display_address': '68 Abingdon Road, Goathill',
'user_id': 'benchmark-user',
'survey_id': '0',
'employment_date': '2019-04-01',
}
},
}


Expand Down Expand Up @@ -80,8 +105,12 @@ def _get_payload_with_params(schema_name, schema_url=None, **extra_payload):
payload_vars['response_expires_at'] = (
datetime.now(tz=timezone.utc) + timedelta(days=7)
).isoformat() # 7 days from now in ISO 8601 format

for key, value in extra_payload.items():
payload_vars[key] = value
if key in TOP_LEVEL_METADATA_KEYS:
payload_vars[key] = value
else:
payload_vars['survey_metadata']['data'][key] = value

return payload_vars

Expand Down
Loading