workos 9.5.0 → 10.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/block-generated-edits.yml +13 -0
- data/.github/workflows/ci.yml +1 -1
- data/.github/workflows/docs.yml +1 -1
- data/.github/workflows/lint.yml +1 -1
- data/.github/workflows/release-please.yml +7 -1
- data/.github/workflows/release.yml +1 -1
- data/.last-synced-sha +1 -1
- data/.oagen-manifest.json +197 -75
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +87 -0
- data/Gemfile.lock +2 -2
- data/README.md +15 -14
- data/lib/workos/agents/agent_admin_link_claim_attempt_to_external_user_request.rb +28 -0
- data/lib/workos/agents/agent_admin_link_claim_attempt_to_external_user_request_user.rb +22 -0
- data/lib/workos/agents/agent_admin_validate_credential_request.rb +25 -0
- data/lib/workos/agents/agent_credential_validation.rb +25 -0
- data/lib/workos/agents/agent_registration.rb +40 -0
- data/lib/workos/agents/agent_registration_agent_identity.rb +28 -0
- data/lib/workos/agents/agent_registration_claim.rb +31 -0
- data/lib/workos/agents/agent_registration_claim_claim_completion.rb +31 -0
- data/lib/workos/agents/claim_view_response.rb +28 -0
- data/lib/workos/agents/claim_view_response_organization.rb +7 -0
- data/lib/workos/agents.rb +93 -0
- data/lib/workos/api_keys/api_key_validation_response.rb +6 -2
- data/lib/workos/api_keys.rb +3 -4
- data/lib/workos/authorization/permission_created_data.rb +1 -34
- data/lib/workos/authorization/permission_deleted_data.rb +1 -1
- data/lib/workos/authorization/permission_updated_data.rb +1 -1
- data/lib/workos/authorization.rb +24 -24
- data/lib/workos/base_client.rb +4 -4
- data/lib/workos/client.rb +4 -0
- data/lib/workos/connect.rb +23 -19
- data/lib/workos/directory_sync.rb +10 -2
- data/lib/workos/groups.rb +7 -7
- data/lib/workos/inflections.rb +0 -1
- data/lib/workos/organization_domains.rb +4 -4
- data/lib/workos/organizations/organization_authorized_connect_application_list_data.rb +34 -0
- data/lib/workos/organizations.rb +57 -10
- data/lib/workos/pipes/api_key_installation.rb +25 -0
- data/lib/workos/pipes/{connected_account_dto.rb → connected_account_input.rb} +1 -1
- data/lib/workos/pipes/create_data_integration.rb +7 -1
- data/lib/workos/pipes/data_integration.rb +6 -0
- data/lib/workos/pipes/{data_integration_credentials_dto.rb → data_integration_credentials_input.rb} +1 -1
- data/lib/workos/pipes/data_integration_installation.rb +28 -0
- data/lib/workos/pipes/data_integrations_upsert_api_key_request.rb +1 -19
- data/lib/workos/pipes/update_data_integration.rb +4 -1
- data/lib/workos/pipes.rb +25 -16
- data/lib/workos/pipes_provider.rb +2 -2
- data/lib/workos/shared/access_token_agent_registration_credential_issued_data_detail.rb +25 -0
- data/lib/workos/shared/agent_registration_claim_attempt_created.rb +34 -0
- data/lib/workos/shared/agent_registration_claim_attempt_created_data.rb +40 -0
- data/lib/workos/shared/agent_registration_claim_completed.rb +34 -0
- data/lib/workos/shared/agent_registration_claim_completed_data.rb +40 -0
- data/lib/workos/shared/agent_registration_claim_completed_data_claimed_by.rb +22 -0
- data/lib/workos/shared/agent_registration_created.rb +34 -0
- data/lib/workos/{organization_domains/organization_domain_stand_alone.rb → shared/agent_registration_created_data.rb} +13 -16
- data/lib/workos/shared/agent_registration_created_data_agent_identity.rb +25 -0
- data/lib/workos/shared/agent_registration_credential_issued.rb +34 -0
- data/lib/workos/shared/agent_registration_credential_issued_data.rb +34 -0
- data/lib/workos/shared/agent_registration_credential_issued_data_detail.rb +22 -0
- data/lib/workos/shared/agent_registration_deleted.rb +34 -0
- data/lib/workos/shared/agent_registration_deleted_data.rb +18 -0
- data/lib/workos/shared/agent_registration_expired.rb +34 -0
- data/lib/workos/shared/agent_registration_expired_data.rb +7 -0
- data/lib/workos/shared/agent_registration_organization_switched.rb +34 -0
- data/lib/workos/shared/agent_registration_organization_switched_data.rb +25 -0
- data/lib/workos/shared/agent_registration_revoked.rb +34 -0
- data/lib/workos/shared/agent_registration_revoked_data.rb +7 -0
- data/lib/workos/shared/pipes_connected_account_connection_failed.rb +34 -0
- data/lib/workos/shared/pipes_connected_account_connection_failed_data.rb +46 -0
- data/lib/workos/shared/radar_challenge_created.rb +34 -0
- data/lib/workos/shared/radar_challenge_created_data.rb +28 -0
- data/lib/workos/sso/connection.rb +3 -3
- data/lib/workos/types/agent_admin_validate_credential_request_type.rb +13 -0
- data/lib/workos/types/agent_registration_created_data_kind.rb +14 -0
- data/lib/workos/types/agent_registration_created_data_method.rb +14 -0
- data/lib/workos/types/agent_registration_created_data_status.rb +15 -0
- data/lib/workos/types/{data_integration_credentials_type.rb → agent_registration_kind.rb} +1 -1
- data/lib/workos/types/{organization_domain_stand_alone_state.rb → agent_registration_status.rb} +1 -1
- data/lib/workos/types/applications_registration_types.rb +13 -0
- data/lib/workos/types/{organization_domain_stand_alone_verification_strategy.rb → claim_view_response_status.rb} +1 -1
- data/lib/workos/types/connected_account_input_state.rb +13 -0
- data/lib/workos/types/connected_account_state.rb +2 -1
- data/lib/workos/types/create_data_integration_auth_methods.rb +9 -0
- data/lib/workos/types/create_user_password_hash_type.rb +2 -1
- data/lib/workos/types/create_webhook_endpoint_events.rb +5 -1
- data/lib/workos/types/data_integration_auth_methods.rb +9 -0
- data/lib/workos/types/data_integration_credentials_input_type.rb +9 -0
- data/lib/workos/types/data_integrations_list_response_data_connected_account_state.rb +1 -6
- data/lib/workos/types/pipe_connected_account_state.rb +1 -5
- data/lib/workos/types/vault_kek_deleted_data_actor_source.rb +9 -0
- data/lib/workos/user_management/authentication_reauthentication_succeeded.rb +34 -0
- data/lib/workos/user_management/authentication_reauthentication_succeeded_data.rb +34 -0
- data/lib/workos/user_management/radar_challenge.rb +43 -0
- data/lib/workos/user_management.rb +59 -23
- data/lib/workos/vault/vault_kek_deleted.rb +34 -0
- data/lib/workos/vault/vault_kek_deleted_data.rb +31 -0
- data/lib/workos/vault.rb +4 -4
- data/lib/workos/version.rb +1 -1
- data/lib/workos/widgets.rb +2 -2
- data/lib/workos.rb +11 -0
- data/rbi/workos/access_token_agent_registration_credential_issued_data_detail.rbi +36 -0
- data/rbi/workos/agent_admin_link_claim_attempt_to_external_user_request.rbi +42 -0
- data/rbi/workos/agent_admin_link_claim_attempt_to_external_user_request_user.rbi +30 -0
- data/rbi/workos/agent_admin_validate_credential_request.rbi +36 -0
- data/rbi/workos/{sso_intent_options.rbi → agent_credential_validation.rbi} +11 -5
- data/rbi/workos/agent_registration.rbi +66 -0
- data/rbi/workos/agent_registration_agent_identity.rbi +42 -0
- data/rbi/workos/agent_registration_claim.rbi +48 -0
- data/rbi/workos/agent_registration_claim_attempt_created.rbi +54 -0
- data/rbi/workos/agent_registration_claim_attempt_created_data.rbi +66 -0
- data/rbi/workos/agent_registration_claim_claim_completion.rbi +48 -0
- data/rbi/workos/agent_registration_claim_completed.rbi +54 -0
- data/rbi/workos/agent_registration_claim_completed_data.rbi +66 -0
- data/rbi/workos/agent_registration_claim_completed_data_claimed_by.rbi +30 -0
- data/rbi/workos/agent_registration_created.rbi +54 -0
- data/rbi/workos/agent_registration_created_data.rbi +72 -0
- data/rbi/workos/agent_registration_created_data_agent_identity.rbi +36 -0
- data/rbi/workos/agent_registration_credential_issued.rbi +54 -0
- data/rbi/workos/agent_registration_credential_issued_data.rbi +54 -0
- data/rbi/workos/agent_registration_credential_issued_data_detail.rbi +30 -0
- data/rbi/workos/agent_registration_deleted.rbi +54 -0
- data/rbi/workos/{connection_option.rbi → agent_registration_deleted_data.rbi} +5 -5
- data/rbi/workos/agent_registration_expired.rbi +54 -0
- data/rbi/workos/{domain_verification_intent_options.rbi → agent_registration_expired_data.rbi} +5 -5
- data/rbi/workos/agent_registration_organization_switched.rbi +54 -0
- data/rbi/workos/agent_registration_organization_switched_data.rbi +36 -0
- data/rbi/workos/agent_registration_revoked.rbi +54 -0
- data/rbi/workos/agent_registration_revoked_data.rbi +24 -0
- data/rbi/workos/agents.rbi +42 -0
- data/rbi/workos/api_key_installation.rbi +36 -0
- data/rbi/workos/api_key_validation_response.rbi +6 -0
- data/rbi/workos/authentication_reauthentication_succeeded.rbi +54 -0
- data/rbi/workos/authentication_reauthentication_succeeded_data.rbi +54 -0
- data/rbi/workos/claim_view_response.rbi +42 -0
- data/rbi/workos/claim_view_response_organization.rbi +30 -0
- data/rbi/workos/client.rbi +3 -0
- data/rbi/workos/connect.rbi +2 -1
- data/rbi/workos/{connected_account_dto.rbi → connected_account_input.rbi} +1 -1
- data/rbi/workos/connection.rbi +4 -4
- data/rbi/workos/create_data_integration.rbi +14 -2
- data/rbi/workos/data_integration.rbi +12 -0
- data/rbi/workos/{data_integration_credentials_dto.rbi → data_integration_credentials_input.rbi} +1 -1
- data/rbi/workos/data_integration_installation.rbi +42 -0
- data/rbi/workos/directory_sync.rbi +3 -1
- data/rbi/workos/organization_authorized_connect_application_list_data.rbi +54 -0
- data/rbi/workos/organization_domains.rbi +2 -2
- data/rbi/workos/organizations.rbi +12 -0
- data/rbi/workos/permission_created_data.rbi +6 -0
- data/rbi/workos/permission_deleted_data.rbi +6 -0
- data/rbi/workos/permission_updated_data.rbi +6 -0
- data/rbi/workos/pipes.rbi +7 -4
- data/rbi/workos/pipes_connected_account_connection_failed.rbi +54 -0
- data/rbi/workos/{organization_domain_stand_alone.rbi → pipes_connected_account_connection_failed_data.rbi} +23 -23
- data/rbi/workos/radar_challenge.rbi +72 -0
- data/rbi/workos/radar_challenge_created.rbi +54 -0
- data/rbi/workos/radar_challenge_created_data.rbi +42 -0
- data/rbi/workos/update_data_integration.rbi +8 -2
- data/rbi/workos/user_management.rbi +16 -0
- data/rbi/workos/vault_kek_deleted.rbi +54 -0
- data/rbi/workos/vault_kek_deleted_data.rbi +48 -0
- data/rbi/workos/widget_session_token.rbi +2 -2
- data/rbi/workos/widgets.rbi +1 -1
- data/test/workos/test_agents.rb +49 -0
- data/test/workos/test_agents_model_round_trip.rb +165 -0
- data/test/workos/test_api_keys_model_round_trip.rb +307 -0
- data/test/workos/test_authorization_model_round_trip.rb +237 -0
- data/test/workos/test_base_client.rb +27 -0
- data/test/workos/test_client_api_model_round_trip.rb +31 -0
- data/test/workos/test_connect_model_round_trip.rb +175 -0
- data/test/workos/test_directory_sync_model_round_trip.rb +579 -0
- data/test/workos/test_feature_flags_model_round_trip.rb +580 -0
- data/test/workos/test_groups_model_round_trip.rb +56 -0
- data/test/workos/test_multi_factor_auth_model_round_trip.rb +192 -0
- data/test/workos/test_organization_domains_model_round_trip.rb +260 -0
- data/test/workos/test_organization_membership_model_round_trip.rb +89 -0
- data/test/workos/test_organizations.rb +9 -1
- data/test/workos/test_organizations_model_round_trip.rb +602 -0
- data/test/workos/test_pipes_model_round_trip.rb +40 -4
- data/test/workos/test_pipes_provider_model_round_trip.rb +75 -0
- data/test/workos/test_shared_model_round_trip.rb +787 -0
- data/test/workos/test_sso_model_round_trip.rb +422 -0
- data/test/workos/test_user_management.rb +16 -0
- data/test/workos/test_user_management_model_round_trip.rb +1501 -0
- data/test/workos/test_vault_model_round_trip.rb +571 -0
- data/test/workos/test_widgets.rb +2 -2
- data/test/workos/test_widgets_model_round_trip.rb +30 -0
- metadata +118 -19
- data/lib/workos/admin_portal/domain_verification_intent_options.rb +0 -18
- data/lib/workos/admin_portal/intent_options.rb +0 -22
- data/lib/workos/admin_portal/sso_intent_options.rb +0 -22
- data/lib/workos/sso/connection_option.rb +0 -18
- data/rbi/workos/intent_options.rbi +0 -30
- data/test/workos/test_model_round_trip.rb +0 -6
|
@@ -274,6 +274,1507 @@ class UserManagementModelRoundTripTest < Minitest::Test
|
|
|
274
274
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
275
275
|
end
|
|
276
276
|
|
|
277
|
+
def test_action_authentication_denied_round_trip
|
|
278
|
+
fixture = {
|
|
279
|
+
"object" => "event",
|
|
280
|
+
"id" => "stub",
|
|
281
|
+
"event" => "action.authentication.denied",
|
|
282
|
+
"data" => {},
|
|
283
|
+
"created_at" => "stub",
|
|
284
|
+
"context" => {}
|
|
285
|
+
}
|
|
286
|
+
model = WorkOS::ActionAuthenticationDenied.new(fixture.to_json)
|
|
287
|
+
json = model.to_h
|
|
288
|
+
assert_kind_of Hash, json
|
|
289
|
+
assert_equal fixture["id"], json[:id]
|
|
290
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
291
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
292
|
+
end
|
|
293
|
+
|
|
294
|
+
def test_action_authentication_denied_data_round_trip
|
|
295
|
+
fixture = {
|
|
296
|
+
"action_endpoint_id" => "stub",
|
|
297
|
+
"action_execution_id" => "stub",
|
|
298
|
+
"type" => "authentication",
|
|
299
|
+
"verdict" => "Deny",
|
|
300
|
+
"user_id" => "stub",
|
|
301
|
+
"organization_id" => nil,
|
|
302
|
+
"email" => "stub",
|
|
303
|
+
"ip_address" => nil,
|
|
304
|
+
"user_agent" => nil
|
|
305
|
+
}
|
|
306
|
+
model = WorkOS::ActionAuthenticationDeniedData.new(fixture.to_json)
|
|
307
|
+
json = model.to_h
|
|
308
|
+
assert_kind_of Hash, json
|
|
309
|
+
assert_equal fixture["action_endpoint_id"], json[:action_endpoint_id]
|
|
310
|
+
assert_equal fixture["action_execution_id"], json[:action_execution_id]
|
|
311
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
312
|
+
assert_nil json[:organization_id]
|
|
313
|
+
assert_equal fixture["email"], json[:email]
|
|
314
|
+
assert_nil json[:ip_address]
|
|
315
|
+
assert_nil json[:user_agent]
|
|
316
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
def test_action_user_registration_denied_round_trip
|
|
320
|
+
fixture = {
|
|
321
|
+
"object" => "event",
|
|
322
|
+
"id" => "stub",
|
|
323
|
+
"event" => "action.user_registration.denied",
|
|
324
|
+
"data" => {},
|
|
325
|
+
"created_at" => "stub",
|
|
326
|
+
"context" => {}
|
|
327
|
+
}
|
|
328
|
+
model = WorkOS::ActionUserRegistrationDenied.new(fixture.to_json)
|
|
329
|
+
json = model.to_h
|
|
330
|
+
assert_kind_of Hash, json
|
|
331
|
+
assert_equal fixture["id"], json[:id]
|
|
332
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
333
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
def test_action_user_registration_denied_data_round_trip
|
|
337
|
+
fixture = {
|
|
338
|
+
"action_endpoint_id" => "stub",
|
|
339
|
+
"action_execution_id" => "stub",
|
|
340
|
+
"type" => "user_registration",
|
|
341
|
+
"verdict" => "Deny",
|
|
342
|
+
"organization_id" => nil,
|
|
343
|
+
"email" => "stub",
|
|
344
|
+
"ip_address" => nil,
|
|
345
|
+
"user_agent" => nil
|
|
346
|
+
}
|
|
347
|
+
model = WorkOS::ActionUserRegistrationDeniedData.new(fixture.to_json)
|
|
348
|
+
json = model.to_h
|
|
349
|
+
assert_kind_of Hash, json
|
|
350
|
+
assert_equal fixture["action_endpoint_id"], json[:action_endpoint_id]
|
|
351
|
+
assert_equal fixture["action_execution_id"], json[:action_execution_id]
|
|
352
|
+
assert_nil json[:organization_id]
|
|
353
|
+
assert_equal fixture["email"], json[:email]
|
|
354
|
+
assert_nil json[:ip_address]
|
|
355
|
+
assert_nil json[:user_agent]
|
|
356
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
def test_user_api_key_created_data_owner_round_trip
|
|
360
|
+
fixture = {
|
|
361
|
+
"type" => "user",
|
|
362
|
+
"id" => "stub",
|
|
363
|
+
"organization_id" => "stub"
|
|
364
|
+
}
|
|
365
|
+
model = WorkOS::UserApiKeyCreatedDataOwner.new(fixture.to_json)
|
|
366
|
+
json = model.to_h
|
|
367
|
+
assert_kind_of Hash, json
|
|
368
|
+
assert_equal fixture["id"], json[:id]
|
|
369
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
370
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
371
|
+
end
|
|
372
|
+
|
|
373
|
+
def test_user_api_key_revoked_data_owner_round_trip
|
|
374
|
+
fixture = {
|
|
375
|
+
"type" => "user",
|
|
376
|
+
"id" => "stub",
|
|
377
|
+
"organization_id" => "stub"
|
|
378
|
+
}
|
|
379
|
+
model = WorkOS::UserApiKeyRevokedDataOwner.new(fixture.to_json)
|
|
380
|
+
json = model.to_h
|
|
381
|
+
assert_kind_of Hash, json
|
|
382
|
+
assert_equal fixture["id"], json[:id]
|
|
383
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
384
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
385
|
+
end
|
|
386
|
+
|
|
387
|
+
def test_user_api_key_updated_data_owner_round_trip
|
|
388
|
+
fixture = {
|
|
389
|
+
"type" => "user",
|
|
390
|
+
"id" => "stub",
|
|
391
|
+
"organization_id" => "stub"
|
|
392
|
+
}
|
|
393
|
+
model = WorkOS::UserApiKeyUpdatedDataOwner.new(fixture.to_json)
|
|
394
|
+
json = model.to_h
|
|
395
|
+
assert_kind_of Hash, json
|
|
396
|
+
assert_equal fixture["id"], json[:id]
|
|
397
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
398
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
399
|
+
end
|
|
400
|
+
|
|
401
|
+
def test_authentication_email_verification_failed_round_trip
|
|
402
|
+
fixture = {
|
|
403
|
+
"object" => "event",
|
|
404
|
+
"id" => "stub",
|
|
405
|
+
"event" => "authentication.email_verification_failed",
|
|
406
|
+
"data" => {},
|
|
407
|
+
"created_at" => "stub",
|
|
408
|
+
"context" => {}
|
|
409
|
+
}
|
|
410
|
+
model = WorkOS::AuthenticationEmailVerificationFailed.new(fixture.to_json)
|
|
411
|
+
json = model.to_h
|
|
412
|
+
assert_kind_of Hash, json
|
|
413
|
+
assert_equal fixture["id"], json[:id]
|
|
414
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
415
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
416
|
+
end
|
|
417
|
+
|
|
418
|
+
def test_authentication_email_verification_failed_data_round_trip
|
|
419
|
+
fixture = {
|
|
420
|
+
"type" => "email_verification",
|
|
421
|
+
"status" => "failed",
|
|
422
|
+
"ip_address" => nil,
|
|
423
|
+
"user_agent" => nil,
|
|
424
|
+
"user_id" => nil,
|
|
425
|
+
"email" => nil,
|
|
426
|
+
"error" => {}
|
|
427
|
+
}
|
|
428
|
+
model = WorkOS::AuthenticationEmailVerificationFailedData.new(fixture.to_json)
|
|
429
|
+
json = model.to_h
|
|
430
|
+
assert_kind_of Hash, json
|
|
431
|
+
assert_nil json[:ip_address]
|
|
432
|
+
assert_nil json[:user_agent]
|
|
433
|
+
assert_nil json[:user_id]
|
|
434
|
+
assert_nil json[:email]
|
|
435
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
def test_authentication_email_verification_failed_data_error_round_trip
|
|
439
|
+
fixture = {
|
|
440
|
+
"code" => "stub",
|
|
441
|
+
"message" => "stub"
|
|
442
|
+
}
|
|
443
|
+
model = WorkOS::AuthenticationEmailVerificationFailedDataError.new(fixture.to_json)
|
|
444
|
+
json = model.to_h
|
|
445
|
+
assert_kind_of Hash, json
|
|
446
|
+
assert_equal fixture["code"], json[:code]
|
|
447
|
+
assert_equal fixture["message"], json[:message]
|
|
448
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
449
|
+
end
|
|
450
|
+
|
|
451
|
+
def test_authentication_email_verification_succeeded_round_trip
|
|
452
|
+
fixture = {
|
|
453
|
+
"object" => "event",
|
|
454
|
+
"id" => "stub",
|
|
455
|
+
"event" => "authentication.email_verification_succeeded",
|
|
456
|
+
"data" => {},
|
|
457
|
+
"created_at" => "stub",
|
|
458
|
+
"context" => {}
|
|
459
|
+
}
|
|
460
|
+
model = WorkOS::AuthenticationEmailVerificationSucceeded.new(fixture.to_json)
|
|
461
|
+
json = model.to_h
|
|
462
|
+
assert_kind_of Hash, json
|
|
463
|
+
assert_equal fixture["id"], json[:id]
|
|
464
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
465
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
def test_authentication_email_verification_succeeded_data_round_trip
|
|
469
|
+
fixture = {
|
|
470
|
+
"type" => "email_verification",
|
|
471
|
+
"status" => "succeeded",
|
|
472
|
+
"ip_address" => nil,
|
|
473
|
+
"user_agent" => nil,
|
|
474
|
+
"user_id" => "stub",
|
|
475
|
+
"email" => "stub"
|
|
476
|
+
}
|
|
477
|
+
model = WorkOS::AuthenticationEmailVerificationSucceededData.new(fixture.to_json)
|
|
478
|
+
json = model.to_h
|
|
479
|
+
assert_kind_of Hash, json
|
|
480
|
+
assert_nil json[:ip_address]
|
|
481
|
+
assert_nil json[:user_agent]
|
|
482
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
483
|
+
assert_equal fixture["email"], json[:email]
|
|
484
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
485
|
+
end
|
|
486
|
+
|
|
487
|
+
def test_authentication_magic_auth_failed_round_trip
|
|
488
|
+
fixture = {
|
|
489
|
+
"object" => "event",
|
|
490
|
+
"id" => "stub",
|
|
491
|
+
"event" => "authentication.magic_auth_failed",
|
|
492
|
+
"data" => {},
|
|
493
|
+
"created_at" => "stub",
|
|
494
|
+
"context" => {}
|
|
495
|
+
}
|
|
496
|
+
model = WorkOS::AuthenticationMagicAuthFailed.new(fixture.to_json)
|
|
497
|
+
json = model.to_h
|
|
498
|
+
assert_kind_of Hash, json
|
|
499
|
+
assert_equal fixture["id"], json[:id]
|
|
500
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
501
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
def test_authentication_magic_auth_failed_data_round_trip
|
|
505
|
+
fixture = {
|
|
506
|
+
"type" => "magic_auth",
|
|
507
|
+
"status" => "failed",
|
|
508
|
+
"ip_address" => nil,
|
|
509
|
+
"user_agent" => nil,
|
|
510
|
+
"user_id" => nil,
|
|
511
|
+
"email" => nil,
|
|
512
|
+
"error" => {}
|
|
513
|
+
}
|
|
514
|
+
model = WorkOS::AuthenticationMagicAuthFailedData.new(fixture.to_json)
|
|
515
|
+
json = model.to_h
|
|
516
|
+
assert_kind_of Hash, json
|
|
517
|
+
assert_nil json[:ip_address]
|
|
518
|
+
assert_nil json[:user_agent]
|
|
519
|
+
assert_nil json[:user_id]
|
|
520
|
+
assert_nil json[:email]
|
|
521
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
def test_authentication_magic_auth_failed_data_error_round_trip
|
|
525
|
+
fixture = {
|
|
526
|
+
"code" => "stub",
|
|
527
|
+
"message" => "stub"
|
|
528
|
+
}
|
|
529
|
+
model = WorkOS::AuthenticationMagicAuthFailedDataError.new(fixture.to_json)
|
|
530
|
+
json = model.to_h
|
|
531
|
+
assert_kind_of Hash, json
|
|
532
|
+
assert_equal fixture["code"], json[:code]
|
|
533
|
+
assert_equal fixture["message"], json[:message]
|
|
534
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
535
|
+
end
|
|
536
|
+
|
|
537
|
+
def test_authentication_magic_auth_succeeded_round_trip
|
|
538
|
+
fixture = {
|
|
539
|
+
"object" => "event",
|
|
540
|
+
"id" => "stub",
|
|
541
|
+
"event" => "authentication.magic_auth_succeeded",
|
|
542
|
+
"data" => {},
|
|
543
|
+
"created_at" => "stub",
|
|
544
|
+
"context" => {}
|
|
545
|
+
}
|
|
546
|
+
model = WorkOS::AuthenticationMagicAuthSucceeded.new(fixture.to_json)
|
|
547
|
+
json = model.to_h
|
|
548
|
+
assert_kind_of Hash, json
|
|
549
|
+
assert_equal fixture["id"], json[:id]
|
|
550
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
551
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
552
|
+
end
|
|
553
|
+
|
|
554
|
+
def test_authentication_magic_auth_succeeded_data_round_trip
|
|
555
|
+
fixture = {
|
|
556
|
+
"type" => "magic_auth",
|
|
557
|
+
"status" => "succeeded",
|
|
558
|
+
"ip_address" => nil,
|
|
559
|
+
"user_agent" => nil,
|
|
560
|
+
"user_id" => "stub",
|
|
561
|
+
"email" => "stub"
|
|
562
|
+
}
|
|
563
|
+
model = WorkOS::AuthenticationMagicAuthSucceededData.new(fixture.to_json)
|
|
564
|
+
json = model.to_h
|
|
565
|
+
assert_kind_of Hash, json
|
|
566
|
+
assert_nil json[:ip_address]
|
|
567
|
+
assert_nil json[:user_agent]
|
|
568
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
569
|
+
assert_equal fixture["email"], json[:email]
|
|
570
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
571
|
+
end
|
|
572
|
+
|
|
573
|
+
def test_authentication_mfa_failed_round_trip
|
|
574
|
+
fixture = {
|
|
575
|
+
"object" => "event",
|
|
576
|
+
"id" => "stub",
|
|
577
|
+
"event" => "authentication.mfa_failed",
|
|
578
|
+
"data" => {},
|
|
579
|
+
"created_at" => "stub",
|
|
580
|
+
"context" => {}
|
|
581
|
+
}
|
|
582
|
+
model = WorkOS::AuthenticationMFAFailed.new(fixture.to_json)
|
|
583
|
+
json = model.to_h
|
|
584
|
+
assert_kind_of Hash, json
|
|
585
|
+
assert_equal fixture["id"], json[:id]
|
|
586
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
587
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
588
|
+
end
|
|
589
|
+
|
|
590
|
+
def test_authentication_mfa_failed_data_round_trip
|
|
591
|
+
fixture = {
|
|
592
|
+
"type" => "mfa",
|
|
593
|
+
"status" => "failed",
|
|
594
|
+
"ip_address" => nil,
|
|
595
|
+
"user_agent" => nil,
|
|
596
|
+
"user_id" => nil,
|
|
597
|
+
"email" => nil,
|
|
598
|
+
"error" => {}
|
|
599
|
+
}
|
|
600
|
+
model = WorkOS::AuthenticationMFAFailedData.new(fixture.to_json)
|
|
601
|
+
json = model.to_h
|
|
602
|
+
assert_kind_of Hash, json
|
|
603
|
+
assert_nil json[:ip_address]
|
|
604
|
+
assert_nil json[:user_agent]
|
|
605
|
+
assert_nil json[:user_id]
|
|
606
|
+
assert_nil json[:email]
|
|
607
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
def test_authentication_mfa_failed_data_error_round_trip
|
|
611
|
+
fixture = {
|
|
612
|
+
"code" => "stub",
|
|
613
|
+
"message" => "stub"
|
|
614
|
+
}
|
|
615
|
+
model = WorkOS::AuthenticationMFAFailedDataError.new(fixture.to_json)
|
|
616
|
+
json = model.to_h
|
|
617
|
+
assert_kind_of Hash, json
|
|
618
|
+
assert_equal fixture["code"], json[:code]
|
|
619
|
+
assert_equal fixture["message"], json[:message]
|
|
620
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
621
|
+
end
|
|
622
|
+
|
|
623
|
+
def test_authentication_mfa_succeeded_round_trip
|
|
624
|
+
fixture = {
|
|
625
|
+
"object" => "event",
|
|
626
|
+
"id" => "stub",
|
|
627
|
+
"event" => "authentication.mfa_succeeded",
|
|
628
|
+
"data" => {},
|
|
629
|
+
"created_at" => "stub",
|
|
630
|
+
"context" => {}
|
|
631
|
+
}
|
|
632
|
+
model = WorkOS::AuthenticationMFASucceeded.new(fixture.to_json)
|
|
633
|
+
json = model.to_h
|
|
634
|
+
assert_kind_of Hash, json
|
|
635
|
+
assert_equal fixture["id"], json[:id]
|
|
636
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
637
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
638
|
+
end
|
|
639
|
+
|
|
640
|
+
def test_authentication_mfa_succeeded_data_round_trip
|
|
641
|
+
fixture = {
|
|
642
|
+
"type" => "mfa",
|
|
643
|
+
"status" => "succeeded",
|
|
644
|
+
"ip_address" => nil,
|
|
645
|
+
"user_agent" => nil,
|
|
646
|
+
"user_id" => "stub",
|
|
647
|
+
"email" => "stub"
|
|
648
|
+
}
|
|
649
|
+
model = WorkOS::AuthenticationMFASucceededData.new(fixture.to_json)
|
|
650
|
+
json = model.to_h
|
|
651
|
+
assert_kind_of Hash, json
|
|
652
|
+
assert_nil json[:ip_address]
|
|
653
|
+
assert_nil json[:user_agent]
|
|
654
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
655
|
+
assert_equal fixture["email"], json[:email]
|
|
656
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
657
|
+
end
|
|
658
|
+
|
|
659
|
+
def test_authentication_oauth_failed_round_trip
|
|
660
|
+
fixture = {
|
|
661
|
+
"object" => "event",
|
|
662
|
+
"id" => "stub",
|
|
663
|
+
"event" => "authentication.oauth_failed",
|
|
664
|
+
"data" => {},
|
|
665
|
+
"created_at" => "stub",
|
|
666
|
+
"context" => {}
|
|
667
|
+
}
|
|
668
|
+
model = WorkOS::AuthenticationOAuthFailed.new(fixture.to_json)
|
|
669
|
+
json = model.to_h
|
|
670
|
+
assert_kind_of Hash, json
|
|
671
|
+
assert_equal fixture["id"], json[:id]
|
|
672
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
673
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
674
|
+
end
|
|
675
|
+
|
|
676
|
+
def test_authentication_oauth_failed_data_round_trip
|
|
677
|
+
fixture = {
|
|
678
|
+
"type" => "oauth",
|
|
679
|
+
"status" => "failed",
|
|
680
|
+
"ip_address" => nil,
|
|
681
|
+
"user_agent" => nil,
|
|
682
|
+
"user_id" => nil,
|
|
683
|
+
"email" => nil,
|
|
684
|
+
"error" => {}
|
|
685
|
+
}
|
|
686
|
+
model = WorkOS::AuthenticationOAuthFailedData.new(fixture.to_json)
|
|
687
|
+
json = model.to_h
|
|
688
|
+
assert_kind_of Hash, json
|
|
689
|
+
assert_nil json[:ip_address]
|
|
690
|
+
assert_nil json[:user_agent]
|
|
691
|
+
assert_nil json[:user_id]
|
|
692
|
+
assert_nil json[:email]
|
|
693
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
694
|
+
end
|
|
695
|
+
|
|
696
|
+
def test_authentication_oauth_failed_data_error_round_trip
|
|
697
|
+
fixture = {
|
|
698
|
+
"code" => "stub",
|
|
699
|
+
"message" => "stub"
|
|
700
|
+
}
|
|
701
|
+
model = WorkOS::AuthenticationOAuthFailedDataError.new(fixture.to_json)
|
|
702
|
+
json = model.to_h
|
|
703
|
+
assert_kind_of Hash, json
|
|
704
|
+
assert_equal fixture["code"], json[:code]
|
|
705
|
+
assert_equal fixture["message"], json[:message]
|
|
706
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
707
|
+
end
|
|
708
|
+
|
|
709
|
+
def test_authentication_oauth_succeeded_round_trip
|
|
710
|
+
fixture = {
|
|
711
|
+
"object" => "event",
|
|
712
|
+
"id" => "stub",
|
|
713
|
+
"event" => "authentication.oauth_succeeded",
|
|
714
|
+
"data" => {},
|
|
715
|
+
"created_at" => "stub",
|
|
716
|
+
"context" => {}
|
|
717
|
+
}
|
|
718
|
+
model = WorkOS::AuthenticationOAuthSucceeded.new(fixture.to_json)
|
|
719
|
+
json = model.to_h
|
|
720
|
+
assert_kind_of Hash, json
|
|
721
|
+
assert_equal fixture["id"], json[:id]
|
|
722
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
723
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
724
|
+
end
|
|
725
|
+
|
|
726
|
+
def test_authentication_oauth_succeeded_data_round_trip
|
|
727
|
+
fixture = {
|
|
728
|
+
"type" => "oauth",
|
|
729
|
+
"status" => "succeeded",
|
|
730
|
+
"ip_address" => nil,
|
|
731
|
+
"user_agent" => nil,
|
|
732
|
+
"user_id" => nil,
|
|
733
|
+
"email" => "stub"
|
|
734
|
+
}
|
|
735
|
+
model = WorkOS::AuthenticationOAuthSucceededData.new(fixture.to_json)
|
|
736
|
+
json = model.to_h
|
|
737
|
+
assert_kind_of Hash, json
|
|
738
|
+
assert_nil json[:ip_address]
|
|
739
|
+
assert_nil json[:user_agent]
|
|
740
|
+
assert_nil json[:user_id]
|
|
741
|
+
assert_equal fixture["email"], json[:email]
|
|
742
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
743
|
+
end
|
|
744
|
+
|
|
745
|
+
def test_authentication_passkey_failed_round_trip
|
|
746
|
+
fixture = {
|
|
747
|
+
"object" => "event",
|
|
748
|
+
"id" => "stub",
|
|
749
|
+
"event" => "authentication.passkey_failed",
|
|
750
|
+
"data" => {},
|
|
751
|
+
"created_at" => "stub",
|
|
752
|
+
"context" => {}
|
|
753
|
+
}
|
|
754
|
+
model = WorkOS::AuthenticationPasskeyFailed.new(fixture.to_json)
|
|
755
|
+
json = model.to_h
|
|
756
|
+
assert_kind_of Hash, json
|
|
757
|
+
assert_equal fixture["id"], json[:id]
|
|
758
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
759
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
760
|
+
end
|
|
761
|
+
|
|
762
|
+
def test_authentication_passkey_failed_data_round_trip
|
|
763
|
+
fixture = {
|
|
764
|
+
"type" => "passkey",
|
|
765
|
+
"status" => "failed",
|
|
766
|
+
"ip_address" => nil,
|
|
767
|
+
"user_agent" => nil,
|
|
768
|
+
"user_id" => nil,
|
|
769
|
+
"email" => nil,
|
|
770
|
+
"error" => {}
|
|
771
|
+
}
|
|
772
|
+
model = WorkOS::AuthenticationPasskeyFailedData.new(fixture.to_json)
|
|
773
|
+
json = model.to_h
|
|
774
|
+
assert_kind_of Hash, json
|
|
775
|
+
assert_nil json[:ip_address]
|
|
776
|
+
assert_nil json[:user_agent]
|
|
777
|
+
assert_nil json[:user_id]
|
|
778
|
+
assert_nil json[:email]
|
|
779
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
780
|
+
end
|
|
781
|
+
|
|
782
|
+
def test_authentication_passkey_failed_data_error_round_trip
|
|
783
|
+
fixture = {
|
|
784
|
+
"code" => "stub",
|
|
785
|
+
"message" => "stub"
|
|
786
|
+
}
|
|
787
|
+
model = WorkOS::AuthenticationPasskeyFailedDataError.new(fixture.to_json)
|
|
788
|
+
json = model.to_h
|
|
789
|
+
assert_kind_of Hash, json
|
|
790
|
+
assert_equal fixture["code"], json[:code]
|
|
791
|
+
assert_equal fixture["message"], json[:message]
|
|
792
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
793
|
+
end
|
|
794
|
+
|
|
795
|
+
def test_authentication_passkey_succeeded_round_trip
|
|
796
|
+
fixture = {
|
|
797
|
+
"object" => "event",
|
|
798
|
+
"id" => "stub",
|
|
799
|
+
"event" => "authentication.passkey_succeeded",
|
|
800
|
+
"data" => {},
|
|
801
|
+
"created_at" => "stub",
|
|
802
|
+
"context" => {}
|
|
803
|
+
}
|
|
804
|
+
model = WorkOS::AuthenticationPasskeySucceeded.new(fixture.to_json)
|
|
805
|
+
json = model.to_h
|
|
806
|
+
assert_kind_of Hash, json
|
|
807
|
+
assert_equal fixture["id"], json[:id]
|
|
808
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
809
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
810
|
+
end
|
|
811
|
+
|
|
812
|
+
def test_authentication_passkey_succeeded_data_round_trip
|
|
813
|
+
fixture = {
|
|
814
|
+
"type" => "passkey",
|
|
815
|
+
"status" => "succeeded",
|
|
816
|
+
"ip_address" => nil,
|
|
817
|
+
"user_agent" => nil,
|
|
818
|
+
"user_id" => "stub",
|
|
819
|
+
"email" => "stub"
|
|
820
|
+
}
|
|
821
|
+
model = WorkOS::AuthenticationPasskeySucceededData.new(fixture.to_json)
|
|
822
|
+
json = model.to_h
|
|
823
|
+
assert_kind_of Hash, json
|
|
824
|
+
assert_nil json[:ip_address]
|
|
825
|
+
assert_nil json[:user_agent]
|
|
826
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
827
|
+
assert_equal fixture["email"], json[:email]
|
|
828
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
829
|
+
end
|
|
830
|
+
|
|
831
|
+
def test_authentication_password_failed_round_trip
|
|
832
|
+
fixture = {
|
|
833
|
+
"object" => "event",
|
|
834
|
+
"id" => "stub",
|
|
835
|
+
"event" => "authentication.password_failed",
|
|
836
|
+
"data" => {},
|
|
837
|
+
"created_at" => "stub",
|
|
838
|
+
"context" => {}
|
|
839
|
+
}
|
|
840
|
+
model = WorkOS::AuthenticationPasswordFailed.new(fixture.to_json)
|
|
841
|
+
json = model.to_h
|
|
842
|
+
assert_kind_of Hash, json
|
|
843
|
+
assert_equal fixture["id"], json[:id]
|
|
844
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
845
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
846
|
+
end
|
|
847
|
+
|
|
848
|
+
def test_authentication_password_failed_data_round_trip
|
|
849
|
+
fixture = {
|
|
850
|
+
"type" => "password",
|
|
851
|
+
"status" => "failed",
|
|
852
|
+
"ip_address" => nil,
|
|
853
|
+
"user_agent" => nil,
|
|
854
|
+
"user_id" => nil,
|
|
855
|
+
"email" => nil,
|
|
856
|
+
"error" => {}
|
|
857
|
+
}
|
|
858
|
+
model = WorkOS::AuthenticationPasswordFailedData.new(fixture.to_json)
|
|
859
|
+
json = model.to_h
|
|
860
|
+
assert_kind_of Hash, json
|
|
861
|
+
assert_nil json[:ip_address]
|
|
862
|
+
assert_nil json[:user_agent]
|
|
863
|
+
assert_nil json[:user_id]
|
|
864
|
+
assert_nil json[:email]
|
|
865
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
866
|
+
end
|
|
867
|
+
|
|
868
|
+
def test_authentication_password_failed_data_error_round_trip
|
|
869
|
+
fixture = {
|
|
870
|
+
"code" => "stub",
|
|
871
|
+
"message" => "stub"
|
|
872
|
+
}
|
|
873
|
+
model = WorkOS::AuthenticationPasswordFailedDataError.new(fixture.to_json)
|
|
874
|
+
json = model.to_h
|
|
875
|
+
assert_kind_of Hash, json
|
|
876
|
+
assert_equal fixture["code"], json[:code]
|
|
877
|
+
assert_equal fixture["message"], json[:message]
|
|
878
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
879
|
+
end
|
|
880
|
+
|
|
881
|
+
def test_authentication_password_succeeded_round_trip
|
|
882
|
+
fixture = {
|
|
883
|
+
"object" => "event",
|
|
884
|
+
"id" => "stub",
|
|
885
|
+
"event" => "authentication.password_succeeded",
|
|
886
|
+
"data" => {},
|
|
887
|
+
"created_at" => "stub",
|
|
888
|
+
"context" => {}
|
|
889
|
+
}
|
|
890
|
+
model = WorkOS::AuthenticationPasswordSucceeded.new(fixture.to_json)
|
|
891
|
+
json = model.to_h
|
|
892
|
+
assert_kind_of Hash, json
|
|
893
|
+
assert_equal fixture["id"], json[:id]
|
|
894
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
895
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
896
|
+
end
|
|
897
|
+
|
|
898
|
+
def test_authentication_password_succeeded_data_round_trip
|
|
899
|
+
fixture = {
|
|
900
|
+
"type" => "password",
|
|
901
|
+
"status" => "succeeded",
|
|
902
|
+
"ip_address" => nil,
|
|
903
|
+
"user_agent" => nil,
|
|
904
|
+
"user_id" => "stub",
|
|
905
|
+
"email" => "stub"
|
|
906
|
+
}
|
|
907
|
+
model = WorkOS::AuthenticationPasswordSucceededData.new(fixture.to_json)
|
|
908
|
+
json = model.to_h
|
|
909
|
+
assert_kind_of Hash, json
|
|
910
|
+
assert_nil json[:ip_address]
|
|
911
|
+
assert_nil json[:user_agent]
|
|
912
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
913
|
+
assert_equal fixture["email"], json[:email]
|
|
914
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
915
|
+
end
|
|
916
|
+
|
|
917
|
+
def test_authentication_radar_risk_detected_round_trip
|
|
918
|
+
fixture = {
|
|
919
|
+
"object" => "event",
|
|
920
|
+
"id" => "stub",
|
|
921
|
+
"event" => "authentication.radar_risk_detected",
|
|
922
|
+
"data" => {},
|
|
923
|
+
"created_at" => "stub",
|
|
924
|
+
"context" => {}
|
|
925
|
+
}
|
|
926
|
+
model = WorkOS::AuthenticationRadarRiskDetected.new(fixture.to_json)
|
|
927
|
+
json = model.to_h
|
|
928
|
+
assert_kind_of Hash, json
|
|
929
|
+
assert_equal fixture["id"], json[:id]
|
|
930
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
931
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
932
|
+
end
|
|
933
|
+
|
|
934
|
+
def test_authentication_radar_risk_detected_data_round_trip
|
|
935
|
+
fixture = {
|
|
936
|
+
"auth_method" => "stub",
|
|
937
|
+
"action" => "stub",
|
|
938
|
+
"control" => nil,
|
|
939
|
+
"blocklist_type" => nil,
|
|
940
|
+
"ip_address" => nil,
|
|
941
|
+
"user_agent" => nil,
|
|
942
|
+
"user_id" => "stub",
|
|
943
|
+
"email" => "stub"
|
|
944
|
+
}
|
|
945
|
+
model = WorkOS::AuthenticationRadarRiskDetectedData.new(fixture.to_json)
|
|
946
|
+
json = model.to_h
|
|
947
|
+
assert_kind_of Hash, json
|
|
948
|
+
assert_equal fixture["auth_method"], json[:auth_method]
|
|
949
|
+
assert_nil json[:control]
|
|
950
|
+
assert_nil json[:blocklist_type]
|
|
951
|
+
assert_nil json[:ip_address]
|
|
952
|
+
assert_nil json[:user_agent]
|
|
953
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
954
|
+
assert_equal fixture["email"], json[:email]
|
|
955
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
956
|
+
end
|
|
957
|
+
|
|
958
|
+
def test_authentication_reauthentication_succeeded_round_trip
|
|
959
|
+
fixture = {
|
|
960
|
+
"object" => "event",
|
|
961
|
+
"id" => "stub",
|
|
962
|
+
"event" => "authentication.reauthentication_succeeded",
|
|
963
|
+
"data" => {},
|
|
964
|
+
"created_at" => "stub",
|
|
965
|
+
"context" => {}
|
|
966
|
+
}
|
|
967
|
+
model = WorkOS::AuthenticationReauthenticationSucceeded.new(fixture.to_json)
|
|
968
|
+
json = model.to_h
|
|
969
|
+
assert_kind_of Hash, json
|
|
970
|
+
assert_equal fixture["id"], json[:id]
|
|
971
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
972
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
973
|
+
end
|
|
974
|
+
|
|
975
|
+
def test_authentication_reauthentication_succeeded_data_round_trip
|
|
976
|
+
fixture = {
|
|
977
|
+
"type" => "reauthentication",
|
|
978
|
+
"status" => "succeeded",
|
|
979
|
+
"ip_address" => nil,
|
|
980
|
+
"user_agent" => nil,
|
|
981
|
+
"user_id" => "stub",
|
|
982
|
+
"email" => "stub"
|
|
983
|
+
}
|
|
984
|
+
model = WorkOS::AuthenticationReauthenticationSucceededData.new(fixture.to_json)
|
|
985
|
+
json = model.to_h
|
|
986
|
+
assert_kind_of Hash, json
|
|
987
|
+
assert_nil json[:ip_address]
|
|
988
|
+
assert_nil json[:user_agent]
|
|
989
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
990
|
+
assert_equal fixture["email"], json[:email]
|
|
991
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
992
|
+
end
|
|
993
|
+
|
|
994
|
+
def test_authentication_sso_failed_round_trip
|
|
995
|
+
fixture = {
|
|
996
|
+
"object" => "event",
|
|
997
|
+
"id" => "stub",
|
|
998
|
+
"event" => "authentication.sso_failed",
|
|
999
|
+
"data" => {},
|
|
1000
|
+
"created_at" => "stub",
|
|
1001
|
+
"context" => {}
|
|
1002
|
+
}
|
|
1003
|
+
model = WorkOS::AuthenticationSSOFailed.new(fixture.to_json)
|
|
1004
|
+
json = model.to_h
|
|
1005
|
+
assert_kind_of Hash, json
|
|
1006
|
+
assert_equal fixture["id"], json[:id]
|
|
1007
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1008
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1009
|
+
end
|
|
1010
|
+
|
|
1011
|
+
def test_authentication_sso_failed_data_round_trip
|
|
1012
|
+
fixture = {
|
|
1013
|
+
"type" => "sso",
|
|
1014
|
+
"status" => "failed",
|
|
1015
|
+
"ip_address" => nil,
|
|
1016
|
+
"user_agent" => nil,
|
|
1017
|
+
"user_id" => nil,
|
|
1018
|
+
"email" => nil,
|
|
1019
|
+
"sso" => {},
|
|
1020
|
+
"error" => {}
|
|
1021
|
+
}
|
|
1022
|
+
model = WorkOS::AuthenticationSSOFailedData.new(fixture.to_json)
|
|
1023
|
+
json = model.to_h
|
|
1024
|
+
assert_kind_of Hash, json
|
|
1025
|
+
assert_nil json[:ip_address]
|
|
1026
|
+
assert_nil json[:user_agent]
|
|
1027
|
+
assert_nil json[:user_id]
|
|
1028
|
+
assert_nil json[:email]
|
|
1029
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1030
|
+
end
|
|
1031
|
+
|
|
1032
|
+
def test_authentication_sso_failed_data_sso_round_trip
|
|
1033
|
+
fixture = {
|
|
1034
|
+
"organization_id" => nil,
|
|
1035
|
+
"connection_id" => nil,
|
|
1036
|
+
"session_id" => nil
|
|
1037
|
+
}
|
|
1038
|
+
model = WorkOS::AuthenticationSSOFailedDataSSO.new(fixture.to_json)
|
|
1039
|
+
json = model.to_h
|
|
1040
|
+
assert_kind_of Hash, json
|
|
1041
|
+
assert_nil json[:organization_id]
|
|
1042
|
+
assert_nil json[:connection_id]
|
|
1043
|
+
assert_nil json[:session_id]
|
|
1044
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1045
|
+
end
|
|
1046
|
+
|
|
1047
|
+
def test_authentication_sso_failed_data_error_round_trip
|
|
1048
|
+
fixture = {
|
|
1049
|
+
"code" => "stub",
|
|
1050
|
+
"message" => "stub"
|
|
1051
|
+
}
|
|
1052
|
+
model = WorkOS::AuthenticationSSOFailedDataError.new(fixture.to_json)
|
|
1053
|
+
json = model.to_h
|
|
1054
|
+
assert_kind_of Hash, json
|
|
1055
|
+
assert_equal fixture["code"], json[:code]
|
|
1056
|
+
assert_equal fixture["message"], json[:message]
|
|
1057
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1058
|
+
end
|
|
1059
|
+
|
|
1060
|
+
def test_authentication_sso_started_round_trip
|
|
1061
|
+
fixture = {
|
|
1062
|
+
"object" => "event",
|
|
1063
|
+
"id" => "stub",
|
|
1064
|
+
"event" => "authentication.sso_started",
|
|
1065
|
+
"data" => {},
|
|
1066
|
+
"created_at" => "stub",
|
|
1067
|
+
"context" => {}
|
|
1068
|
+
}
|
|
1069
|
+
model = WorkOS::AuthenticationSSOStarted.new(fixture.to_json)
|
|
1070
|
+
json = model.to_h
|
|
1071
|
+
assert_kind_of Hash, json
|
|
1072
|
+
assert_equal fixture["id"], json[:id]
|
|
1073
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1074
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1075
|
+
end
|
|
1076
|
+
|
|
1077
|
+
def test_authentication_sso_started_data_round_trip
|
|
1078
|
+
fixture = {
|
|
1079
|
+
"type" => "sso",
|
|
1080
|
+
"status" => "started",
|
|
1081
|
+
"ip_address" => nil,
|
|
1082
|
+
"user_agent" => nil,
|
|
1083
|
+
"user_id" => nil,
|
|
1084
|
+
"email" => nil,
|
|
1085
|
+
"sso" => {}
|
|
1086
|
+
}
|
|
1087
|
+
model = WorkOS::AuthenticationSSOStartedData.new(fixture.to_json)
|
|
1088
|
+
json = model.to_h
|
|
1089
|
+
assert_kind_of Hash, json
|
|
1090
|
+
assert_nil json[:ip_address]
|
|
1091
|
+
assert_nil json[:user_agent]
|
|
1092
|
+
assert_nil json[:user_id]
|
|
1093
|
+
assert_nil json[:email]
|
|
1094
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1095
|
+
end
|
|
1096
|
+
|
|
1097
|
+
def test_authentication_sso_started_data_sso_round_trip
|
|
1098
|
+
fixture = {
|
|
1099
|
+
"organization_id" => nil,
|
|
1100
|
+
"connection_id" => nil,
|
|
1101
|
+
"session_id" => nil
|
|
1102
|
+
}
|
|
1103
|
+
model = WorkOS::AuthenticationSSOStartedDataSSO.new(fixture.to_json)
|
|
1104
|
+
json = model.to_h
|
|
1105
|
+
assert_kind_of Hash, json
|
|
1106
|
+
assert_nil json[:organization_id]
|
|
1107
|
+
assert_nil json[:connection_id]
|
|
1108
|
+
assert_nil json[:session_id]
|
|
1109
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1110
|
+
end
|
|
1111
|
+
|
|
1112
|
+
def test_authentication_sso_succeeded_round_trip
|
|
1113
|
+
fixture = {
|
|
1114
|
+
"object" => "event",
|
|
1115
|
+
"id" => "stub",
|
|
1116
|
+
"event" => "authentication.sso_succeeded",
|
|
1117
|
+
"data" => {},
|
|
1118
|
+
"created_at" => "stub",
|
|
1119
|
+
"context" => {}
|
|
1120
|
+
}
|
|
1121
|
+
model = WorkOS::AuthenticationSSOSucceeded.new(fixture.to_json)
|
|
1122
|
+
json = model.to_h
|
|
1123
|
+
assert_kind_of Hash, json
|
|
1124
|
+
assert_equal fixture["id"], json[:id]
|
|
1125
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1126
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1127
|
+
end
|
|
1128
|
+
|
|
1129
|
+
def test_authentication_sso_succeeded_data_round_trip
|
|
1130
|
+
fixture = {
|
|
1131
|
+
"type" => "sso",
|
|
1132
|
+
"status" => "succeeded",
|
|
1133
|
+
"ip_address" => nil,
|
|
1134
|
+
"user_agent" => nil,
|
|
1135
|
+
"user_id" => nil,
|
|
1136
|
+
"email" => "stub",
|
|
1137
|
+
"sso" => {}
|
|
1138
|
+
}
|
|
1139
|
+
model = WorkOS::AuthenticationSSOSucceededData.new(fixture.to_json)
|
|
1140
|
+
json = model.to_h
|
|
1141
|
+
assert_kind_of Hash, json
|
|
1142
|
+
assert_nil json[:ip_address]
|
|
1143
|
+
assert_nil json[:user_agent]
|
|
1144
|
+
assert_nil json[:user_id]
|
|
1145
|
+
assert_equal fixture["email"], json[:email]
|
|
1146
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1147
|
+
end
|
|
1148
|
+
|
|
1149
|
+
def test_authentication_sso_succeeded_data_sso_round_trip
|
|
1150
|
+
fixture = {
|
|
1151
|
+
"organization_id" => nil,
|
|
1152
|
+
"connection_id" => nil,
|
|
1153
|
+
"session_id" => nil
|
|
1154
|
+
}
|
|
1155
|
+
model = WorkOS::AuthenticationSSOSucceededDataSSO.new(fixture.to_json)
|
|
1156
|
+
json = model.to_h
|
|
1157
|
+
assert_kind_of Hash, json
|
|
1158
|
+
assert_nil json[:organization_id]
|
|
1159
|
+
assert_nil json[:connection_id]
|
|
1160
|
+
assert_nil json[:session_id]
|
|
1161
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1162
|
+
end
|
|
1163
|
+
|
|
1164
|
+
def test_authentication_sso_timed_out_round_trip
|
|
1165
|
+
fixture = {
|
|
1166
|
+
"object" => "event",
|
|
1167
|
+
"id" => "stub",
|
|
1168
|
+
"event" => "authentication.sso_timed_out",
|
|
1169
|
+
"data" => {},
|
|
1170
|
+
"created_at" => "stub",
|
|
1171
|
+
"context" => {}
|
|
1172
|
+
}
|
|
1173
|
+
model = WorkOS::AuthenticationSSOTimedOut.new(fixture.to_json)
|
|
1174
|
+
json = model.to_h
|
|
1175
|
+
assert_kind_of Hash, json
|
|
1176
|
+
assert_equal fixture["id"], json[:id]
|
|
1177
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1178
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1179
|
+
end
|
|
1180
|
+
|
|
1181
|
+
def test_authentication_sso_timed_out_data_round_trip
|
|
1182
|
+
fixture = {
|
|
1183
|
+
"type" => "sso",
|
|
1184
|
+
"status" => "timed_out",
|
|
1185
|
+
"ip_address" => nil,
|
|
1186
|
+
"user_agent" => nil,
|
|
1187
|
+
"user_id" => nil,
|
|
1188
|
+
"email" => nil,
|
|
1189
|
+
"sso" => {},
|
|
1190
|
+
"error" => {}
|
|
1191
|
+
}
|
|
1192
|
+
model = WorkOS::AuthenticationSSOTimedOutData.new(fixture.to_json)
|
|
1193
|
+
json = model.to_h
|
|
1194
|
+
assert_kind_of Hash, json
|
|
1195
|
+
assert_nil json[:ip_address]
|
|
1196
|
+
assert_nil json[:user_agent]
|
|
1197
|
+
assert_nil json[:user_id]
|
|
1198
|
+
assert_nil json[:email]
|
|
1199
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1200
|
+
end
|
|
1201
|
+
|
|
1202
|
+
def test_authentication_sso_timed_out_data_sso_round_trip
|
|
1203
|
+
fixture = {
|
|
1204
|
+
"organization_id" => nil,
|
|
1205
|
+
"connection_id" => nil,
|
|
1206
|
+
"session_id" => nil
|
|
1207
|
+
}
|
|
1208
|
+
model = WorkOS::AuthenticationSSOTimedOutDataSSO.new(fixture.to_json)
|
|
1209
|
+
json = model.to_h
|
|
1210
|
+
assert_kind_of Hash, json
|
|
1211
|
+
assert_nil json[:organization_id]
|
|
1212
|
+
assert_nil json[:connection_id]
|
|
1213
|
+
assert_nil json[:session_id]
|
|
1214
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1215
|
+
end
|
|
1216
|
+
|
|
1217
|
+
def test_authentication_sso_timed_out_data_error_round_trip
|
|
1218
|
+
fixture = {
|
|
1219
|
+
"code" => "stub",
|
|
1220
|
+
"message" => "stub"
|
|
1221
|
+
}
|
|
1222
|
+
model = WorkOS::AuthenticationSSOTimedOutDataError.new(fixture.to_json)
|
|
1223
|
+
json = model.to_h
|
|
1224
|
+
assert_kind_of Hash, json
|
|
1225
|
+
assert_equal fixture["code"], json[:code]
|
|
1226
|
+
assert_equal fixture["message"], json[:message]
|
|
1227
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1228
|
+
end
|
|
1229
|
+
|
|
1230
|
+
def test_email_verification_created_round_trip
|
|
1231
|
+
fixture = {
|
|
1232
|
+
"object" => "event",
|
|
1233
|
+
"id" => "stub",
|
|
1234
|
+
"event" => "email_verification.created",
|
|
1235
|
+
"data" => {},
|
|
1236
|
+
"created_at" => "stub",
|
|
1237
|
+
"context" => {}
|
|
1238
|
+
}
|
|
1239
|
+
model = WorkOS::EmailVerificationCreated.new(fixture.to_json)
|
|
1240
|
+
json = model.to_h
|
|
1241
|
+
assert_kind_of Hash, json
|
|
1242
|
+
assert_equal fixture["id"], json[:id]
|
|
1243
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1244
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1245
|
+
end
|
|
1246
|
+
|
|
1247
|
+
def test_email_verification_created_data_round_trip
|
|
1248
|
+
fixture = {
|
|
1249
|
+
"object" => "email_verification",
|
|
1250
|
+
"id" => "stub",
|
|
1251
|
+
"user_id" => "stub",
|
|
1252
|
+
"email" => "stub",
|
|
1253
|
+
"expires_at" => "stub",
|
|
1254
|
+
"created_at" => "stub",
|
|
1255
|
+
"updated_at" => "stub"
|
|
1256
|
+
}
|
|
1257
|
+
model = WorkOS::EmailVerificationCreatedData.new(fixture.to_json)
|
|
1258
|
+
json = model.to_h
|
|
1259
|
+
assert_kind_of Hash, json
|
|
1260
|
+
assert_equal fixture["id"], json[:id]
|
|
1261
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
1262
|
+
assert_equal fixture["email"], json[:email]
|
|
1263
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1264
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1265
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
1266
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1267
|
+
end
|
|
1268
|
+
|
|
1269
|
+
def test_invitation_accepted_round_trip
|
|
1270
|
+
fixture = {
|
|
1271
|
+
"object" => "event",
|
|
1272
|
+
"id" => "stub",
|
|
1273
|
+
"event" => "invitation.accepted",
|
|
1274
|
+
"data" => {},
|
|
1275
|
+
"created_at" => "stub",
|
|
1276
|
+
"context" => {}
|
|
1277
|
+
}
|
|
1278
|
+
model = WorkOS::InvitationAccepted.new(fixture.to_json)
|
|
1279
|
+
json = model.to_h
|
|
1280
|
+
assert_kind_of Hash, json
|
|
1281
|
+
assert_equal fixture["id"], json[:id]
|
|
1282
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1283
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1284
|
+
end
|
|
1285
|
+
|
|
1286
|
+
def test_invitation_accepted_data_round_trip
|
|
1287
|
+
fixture = {
|
|
1288
|
+
"object" => "invitation",
|
|
1289
|
+
"id" => "stub",
|
|
1290
|
+
"email" => "stub",
|
|
1291
|
+
"state" => "stub",
|
|
1292
|
+
"accepted_at" => nil,
|
|
1293
|
+
"revoked_at" => nil,
|
|
1294
|
+
"expires_at" => "stub",
|
|
1295
|
+
"organization_id" => nil,
|
|
1296
|
+
"inviter_user_id" => nil,
|
|
1297
|
+
"accepted_user_id" => nil,
|
|
1298
|
+
"role_slug" => nil,
|
|
1299
|
+
"created_at" => "stub",
|
|
1300
|
+
"updated_at" => "stub"
|
|
1301
|
+
}
|
|
1302
|
+
model = WorkOS::InvitationAcceptedData.new(fixture.to_json)
|
|
1303
|
+
json = model.to_h
|
|
1304
|
+
assert_kind_of Hash, json
|
|
1305
|
+
assert_equal fixture["id"], json[:id]
|
|
1306
|
+
assert_equal fixture["email"], json[:email]
|
|
1307
|
+
assert_nil json[:accepted_at]
|
|
1308
|
+
assert_nil json[:revoked_at]
|
|
1309
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1310
|
+
assert_nil json[:organization_id]
|
|
1311
|
+
assert_nil json[:inviter_user_id]
|
|
1312
|
+
assert_nil json[:accepted_user_id]
|
|
1313
|
+
assert_nil json[:role_slug]
|
|
1314
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1315
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
1316
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1317
|
+
end
|
|
1318
|
+
|
|
1319
|
+
def test_invitation_created_round_trip
|
|
1320
|
+
fixture = {
|
|
1321
|
+
"object" => "event",
|
|
1322
|
+
"id" => "stub",
|
|
1323
|
+
"event" => "invitation.created",
|
|
1324
|
+
"data" => {},
|
|
1325
|
+
"created_at" => "stub",
|
|
1326
|
+
"context" => {}
|
|
1327
|
+
}
|
|
1328
|
+
model = WorkOS::InvitationCreated.new(fixture.to_json)
|
|
1329
|
+
json = model.to_h
|
|
1330
|
+
assert_kind_of Hash, json
|
|
1331
|
+
assert_equal fixture["id"], json[:id]
|
|
1332
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1333
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1334
|
+
end
|
|
1335
|
+
|
|
1336
|
+
def test_invitation_created_data_round_trip
|
|
1337
|
+
fixture = {
|
|
1338
|
+
"object" => "invitation",
|
|
1339
|
+
"id" => "stub",
|
|
1340
|
+
"email" => "stub",
|
|
1341
|
+
"state" => "stub",
|
|
1342
|
+
"accepted_at" => nil,
|
|
1343
|
+
"revoked_at" => nil,
|
|
1344
|
+
"expires_at" => "stub",
|
|
1345
|
+
"organization_id" => nil,
|
|
1346
|
+
"inviter_user_id" => nil,
|
|
1347
|
+
"accepted_user_id" => nil,
|
|
1348
|
+
"role_slug" => nil,
|
|
1349
|
+
"created_at" => "stub",
|
|
1350
|
+
"updated_at" => "stub"
|
|
1351
|
+
}
|
|
1352
|
+
model = WorkOS::InvitationCreatedData.new(fixture.to_json)
|
|
1353
|
+
json = model.to_h
|
|
1354
|
+
assert_kind_of Hash, json
|
|
1355
|
+
assert_equal fixture["id"], json[:id]
|
|
1356
|
+
assert_equal fixture["email"], json[:email]
|
|
1357
|
+
assert_nil json[:accepted_at]
|
|
1358
|
+
assert_nil json[:revoked_at]
|
|
1359
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1360
|
+
assert_nil json[:organization_id]
|
|
1361
|
+
assert_nil json[:inviter_user_id]
|
|
1362
|
+
assert_nil json[:accepted_user_id]
|
|
1363
|
+
assert_nil json[:role_slug]
|
|
1364
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1365
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
1366
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1367
|
+
end
|
|
1368
|
+
|
|
1369
|
+
def test_invitation_resent_round_trip
|
|
1370
|
+
fixture = {
|
|
1371
|
+
"object" => "event",
|
|
1372
|
+
"id" => "stub",
|
|
1373
|
+
"event" => "invitation.resent",
|
|
1374
|
+
"data" => {},
|
|
1375
|
+
"created_at" => "stub",
|
|
1376
|
+
"context" => {}
|
|
1377
|
+
}
|
|
1378
|
+
model = WorkOS::InvitationResent.new(fixture.to_json)
|
|
1379
|
+
json = model.to_h
|
|
1380
|
+
assert_kind_of Hash, json
|
|
1381
|
+
assert_equal fixture["id"], json[:id]
|
|
1382
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1383
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1384
|
+
end
|
|
1385
|
+
|
|
1386
|
+
def test_invitation_resent_data_round_trip
|
|
1387
|
+
fixture = {
|
|
1388
|
+
"object" => "invitation",
|
|
1389
|
+
"id" => "stub",
|
|
1390
|
+
"email" => "stub",
|
|
1391
|
+
"state" => "stub",
|
|
1392
|
+
"accepted_at" => nil,
|
|
1393
|
+
"revoked_at" => nil,
|
|
1394
|
+
"expires_at" => "stub",
|
|
1395
|
+
"organization_id" => nil,
|
|
1396
|
+
"inviter_user_id" => nil,
|
|
1397
|
+
"accepted_user_id" => nil,
|
|
1398
|
+
"role_slug" => nil,
|
|
1399
|
+
"created_at" => "stub",
|
|
1400
|
+
"updated_at" => "stub"
|
|
1401
|
+
}
|
|
1402
|
+
model = WorkOS::InvitationResentData.new(fixture.to_json)
|
|
1403
|
+
json = model.to_h
|
|
1404
|
+
assert_kind_of Hash, json
|
|
1405
|
+
assert_equal fixture["id"], json[:id]
|
|
1406
|
+
assert_equal fixture["email"], json[:email]
|
|
1407
|
+
assert_nil json[:accepted_at]
|
|
1408
|
+
assert_nil json[:revoked_at]
|
|
1409
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1410
|
+
assert_nil json[:organization_id]
|
|
1411
|
+
assert_nil json[:inviter_user_id]
|
|
1412
|
+
assert_nil json[:accepted_user_id]
|
|
1413
|
+
assert_nil json[:role_slug]
|
|
1414
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1415
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
1416
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1417
|
+
end
|
|
1418
|
+
|
|
1419
|
+
def test_invitation_revoked_round_trip
|
|
1420
|
+
fixture = {
|
|
1421
|
+
"object" => "event",
|
|
1422
|
+
"id" => "stub",
|
|
1423
|
+
"event" => "invitation.revoked",
|
|
1424
|
+
"data" => {},
|
|
1425
|
+
"created_at" => "stub",
|
|
1426
|
+
"context" => {}
|
|
1427
|
+
}
|
|
1428
|
+
model = WorkOS::InvitationRevoked.new(fixture.to_json)
|
|
1429
|
+
json = model.to_h
|
|
1430
|
+
assert_kind_of Hash, json
|
|
1431
|
+
assert_equal fixture["id"], json[:id]
|
|
1432
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1433
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1434
|
+
end
|
|
1435
|
+
|
|
1436
|
+
def test_invitation_revoked_data_round_trip
|
|
1437
|
+
fixture = {
|
|
1438
|
+
"object" => "invitation",
|
|
1439
|
+
"id" => "stub",
|
|
1440
|
+
"email" => "stub",
|
|
1441
|
+
"state" => "stub",
|
|
1442
|
+
"accepted_at" => nil,
|
|
1443
|
+
"revoked_at" => nil,
|
|
1444
|
+
"expires_at" => "stub",
|
|
1445
|
+
"organization_id" => nil,
|
|
1446
|
+
"inviter_user_id" => nil,
|
|
1447
|
+
"accepted_user_id" => nil,
|
|
1448
|
+
"role_slug" => nil,
|
|
1449
|
+
"created_at" => "stub",
|
|
1450
|
+
"updated_at" => "stub"
|
|
1451
|
+
}
|
|
1452
|
+
model = WorkOS::InvitationRevokedData.new(fixture.to_json)
|
|
1453
|
+
json = model.to_h
|
|
1454
|
+
assert_kind_of Hash, json
|
|
1455
|
+
assert_equal fixture["id"], json[:id]
|
|
1456
|
+
assert_equal fixture["email"], json[:email]
|
|
1457
|
+
assert_nil json[:accepted_at]
|
|
1458
|
+
assert_nil json[:revoked_at]
|
|
1459
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1460
|
+
assert_nil json[:organization_id]
|
|
1461
|
+
assert_nil json[:inviter_user_id]
|
|
1462
|
+
assert_nil json[:accepted_user_id]
|
|
1463
|
+
assert_nil json[:role_slug]
|
|
1464
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1465
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
1466
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1467
|
+
end
|
|
1468
|
+
|
|
1469
|
+
def test_magic_auth_created_round_trip
|
|
1470
|
+
fixture = {
|
|
1471
|
+
"object" => "event",
|
|
1472
|
+
"id" => "stub",
|
|
1473
|
+
"event" => "magic_auth.created",
|
|
1474
|
+
"data" => {},
|
|
1475
|
+
"created_at" => "stub",
|
|
1476
|
+
"context" => {}
|
|
1477
|
+
}
|
|
1478
|
+
model = WorkOS::MagicAuthCreated.new(fixture.to_json)
|
|
1479
|
+
json = model.to_h
|
|
1480
|
+
assert_kind_of Hash, json
|
|
1481
|
+
assert_equal fixture["id"], json[:id]
|
|
1482
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1483
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1484
|
+
end
|
|
1485
|
+
|
|
1486
|
+
def test_magic_auth_created_data_round_trip
|
|
1487
|
+
fixture = {
|
|
1488
|
+
"object" => "magic_auth",
|
|
1489
|
+
"id" => "stub",
|
|
1490
|
+
"user_id" => "stub",
|
|
1491
|
+
"email" => "stub",
|
|
1492
|
+
"expires_at" => "stub",
|
|
1493
|
+
"created_at" => "stub",
|
|
1494
|
+
"updated_at" => "stub"
|
|
1495
|
+
}
|
|
1496
|
+
model = WorkOS::MagicAuthCreatedData.new(fixture.to_json)
|
|
1497
|
+
json = model.to_h
|
|
1498
|
+
assert_kind_of Hash, json
|
|
1499
|
+
assert_equal fixture["id"], json[:id]
|
|
1500
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
1501
|
+
assert_equal fixture["email"], json[:email]
|
|
1502
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1503
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1504
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
1505
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1506
|
+
end
|
|
1507
|
+
|
|
1508
|
+
def test_password_reset_created_round_trip
|
|
1509
|
+
fixture = {
|
|
1510
|
+
"object" => "event",
|
|
1511
|
+
"id" => "stub",
|
|
1512
|
+
"event" => "password_reset.created",
|
|
1513
|
+
"data" => {},
|
|
1514
|
+
"created_at" => "stub",
|
|
1515
|
+
"context" => {}
|
|
1516
|
+
}
|
|
1517
|
+
model = WorkOS::PasswordResetCreated.new(fixture.to_json)
|
|
1518
|
+
json = model.to_h
|
|
1519
|
+
assert_kind_of Hash, json
|
|
1520
|
+
assert_equal fixture["id"], json[:id]
|
|
1521
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1522
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1523
|
+
end
|
|
1524
|
+
|
|
1525
|
+
def test_password_reset_created_data_round_trip
|
|
1526
|
+
fixture = {
|
|
1527
|
+
"object" => "password_reset",
|
|
1528
|
+
"id" => "stub",
|
|
1529
|
+
"user_id" => "stub",
|
|
1530
|
+
"email" => "stub",
|
|
1531
|
+
"expires_at" => "stub",
|
|
1532
|
+
"created_at" => "stub"
|
|
1533
|
+
}
|
|
1534
|
+
model = WorkOS::PasswordResetCreatedData.new(fixture.to_json)
|
|
1535
|
+
json = model.to_h
|
|
1536
|
+
assert_kind_of Hash, json
|
|
1537
|
+
assert_equal fixture["id"], json[:id]
|
|
1538
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
1539
|
+
assert_equal fixture["email"], json[:email]
|
|
1540
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1541
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1542
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1543
|
+
end
|
|
1544
|
+
|
|
1545
|
+
def test_password_reset_succeeded_round_trip
|
|
1546
|
+
fixture = {
|
|
1547
|
+
"object" => "event",
|
|
1548
|
+
"id" => "stub",
|
|
1549
|
+
"event" => "password_reset.succeeded",
|
|
1550
|
+
"data" => {},
|
|
1551
|
+
"created_at" => "stub",
|
|
1552
|
+
"context" => {}
|
|
1553
|
+
}
|
|
1554
|
+
model = WorkOS::PasswordResetSucceeded.new(fixture.to_json)
|
|
1555
|
+
json = model.to_h
|
|
1556
|
+
assert_kind_of Hash, json
|
|
1557
|
+
assert_equal fixture["id"], json[:id]
|
|
1558
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1559
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1560
|
+
end
|
|
1561
|
+
|
|
1562
|
+
def test_password_reset_succeeded_data_round_trip
|
|
1563
|
+
fixture = {
|
|
1564
|
+
"object" => "password_reset",
|
|
1565
|
+
"id" => "stub",
|
|
1566
|
+
"user_id" => "stub",
|
|
1567
|
+
"email" => "stub",
|
|
1568
|
+
"expires_at" => "stub",
|
|
1569
|
+
"created_at" => "stub"
|
|
1570
|
+
}
|
|
1571
|
+
model = WorkOS::PasswordResetSucceededData.new(fixture.to_json)
|
|
1572
|
+
json = model.to_h
|
|
1573
|
+
assert_kind_of Hash, json
|
|
1574
|
+
assert_equal fixture["id"], json[:id]
|
|
1575
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
1576
|
+
assert_equal fixture["email"], json[:email]
|
|
1577
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1578
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1579
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1580
|
+
end
|
|
1581
|
+
|
|
1582
|
+
def test_session_created_round_trip
|
|
1583
|
+
fixture = {
|
|
1584
|
+
"object" => "event",
|
|
1585
|
+
"id" => "stub",
|
|
1586
|
+
"event" => "session.created",
|
|
1587
|
+
"data" => {},
|
|
1588
|
+
"created_at" => "stub",
|
|
1589
|
+
"context" => {}
|
|
1590
|
+
}
|
|
1591
|
+
model = WorkOS::SessionCreated.new(fixture.to_json)
|
|
1592
|
+
json = model.to_h
|
|
1593
|
+
assert_kind_of Hash, json
|
|
1594
|
+
assert_equal fixture["id"], json[:id]
|
|
1595
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1596
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1597
|
+
end
|
|
1598
|
+
|
|
1599
|
+
def test_session_created_data_round_trip
|
|
1600
|
+
fixture = {
|
|
1601
|
+
"object" => "session",
|
|
1602
|
+
"id" => "stub",
|
|
1603
|
+
"impersonator" => {},
|
|
1604
|
+
"ip_address" => nil,
|
|
1605
|
+
"organization_id" => "stub",
|
|
1606
|
+
"user_agent" => nil,
|
|
1607
|
+
"user_id" => "stub",
|
|
1608
|
+
"auth_method" => "stub",
|
|
1609
|
+
"status" => "stub",
|
|
1610
|
+
"expires_at" => "stub",
|
|
1611
|
+
"ended_at" => nil,
|
|
1612
|
+
"created_at" => "stub",
|
|
1613
|
+
"updated_at" => "stub"
|
|
1614
|
+
}
|
|
1615
|
+
model = WorkOS::SessionCreatedData.new(fixture.to_json)
|
|
1616
|
+
json = model.to_h
|
|
1617
|
+
assert_kind_of Hash, json
|
|
1618
|
+
assert_equal fixture["id"], json[:id]
|
|
1619
|
+
assert_nil json[:ip_address]
|
|
1620
|
+
assert_nil json[:user_agent]
|
|
1621
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
1622
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1623
|
+
assert_nil json[:ended_at]
|
|
1624
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1625
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
1626
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1627
|
+
end
|
|
1628
|
+
|
|
1629
|
+
def test_session_created_data_impersonator_round_trip
|
|
1630
|
+
fixture = {
|
|
1631
|
+
"email" => "stub",
|
|
1632
|
+
"reason" => nil
|
|
1633
|
+
}
|
|
1634
|
+
model = WorkOS::SessionCreatedDataImpersonator.new(fixture.to_json)
|
|
1635
|
+
json = model.to_h
|
|
1636
|
+
assert_kind_of Hash, json
|
|
1637
|
+
assert_equal fixture["email"], json[:email]
|
|
1638
|
+
assert_nil json[:reason]
|
|
1639
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1640
|
+
end
|
|
1641
|
+
|
|
1642
|
+
def test_session_revoked_round_trip
|
|
1643
|
+
fixture = {
|
|
1644
|
+
"object" => "event",
|
|
1645
|
+
"id" => "stub",
|
|
1646
|
+
"event" => "session.revoked",
|
|
1647
|
+
"data" => {},
|
|
1648
|
+
"created_at" => "stub",
|
|
1649
|
+
"context" => {}
|
|
1650
|
+
}
|
|
1651
|
+
model = WorkOS::SessionRevoked.new(fixture.to_json)
|
|
1652
|
+
json = model.to_h
|
|
1653
|
+
assert_kind_of Hash, json
|
|
1654
|
+
assert_equal fixture["id"], json[:id]
|
|
1655
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1656
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1657
|
+
end
|
|
1658
|
+
|
|
1659
|
+
def test_session_revoked_data_round_trip
|
|
1660
|
+
fixture = {
|
|
1661
|
+
"object" => "session",
|
|
1662
|
+
"id" => "stub",
|
|
1663
|
+
"impersonator" => {},
|
|
1664
|
+
"ip_address" => nil,
|
|
1665
|
+
"organization_id" => "stub",
|
|
1666
|
+
"user_agent" => nil,
|
|
1667
|
+
"user_id" => "stub",
|
|
1668
|
+
"auth_method" => "stub",
|
|
1669
|
+
"status" => "stub",
|
|
1670
|
+
"expires_at" => "stub",
|
|
1671
|
+
"ended_at" => nil,
|
|
1672
|
+
"created_at" => "stub",
|
|
1673
|
+
"updated_at" => "stub"
|
|
1674
|
+
}
|
|
1675
|
+
model = WorkOS::SessionRevokedData.new(fixture.to_json)
|
|
1676
|
+
json = model.to_h
|
|
1677
|
+
assert_kind_of Hash, json
|
|
1678
|
+
assert_equal fixture["id"], json[:id]
|
|
1679
|
+
assert_nil json[:ip_address]
|
|
1680
|
+
assert_nil json[:user_agent]
|
|
1681
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
1682
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1683
|
+
assert_nil json[:ended_at]
|
|
1684
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1685
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
1686
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1687
|
+
end
|
|
1688
|
+
|
|
1689
|
+
def test_session_revoked_data_impersonator_round_trip
|
|
1690
|
+
fixture = {
|
|
1691
|
+
"email" => "stub",
|
|
1692
|
+
"reason" => nil
|
|
1693
|
+
}
|
|
1694
|
+
model = WorkOS::SessionRevokedDataImpersonator.new(fixture.to_json)
|
|
1695
|
+
json = model.to_h
|
|
1696
|
+
assert_kind_of Hash, json
|
|
1697
|
+
assert_equal fixture["email"], json[:email]
|
|
1698
|
+
assert_nil json[:reason]
|
|
1699
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1700
|
+
end
|
|
1701
|
+
|
|
1702
|
+
def test_user_created_round_trip
|
|
1703
|
+
fixture = {
|
|
1704
|
+
"object" => "event",
|
|
1705
|
+
"id" => "stub",
|
|
1706
|
+
"event" => "user.created",
|
|
1707
|
+
"data" => {},
|
|
1708
|
+
"created_at" => "stub",
|
|
1709
|
+
"context" => {}
|
|
1710
|
+
}
|
|
1711
|
+
model = WorkOS::UserCreated.new(fixture.to_json)
|
|
1712
|
+
json = model.to_h
|
|
1713
|
+
assert_kind_of Hash, json
|
|
1714
|
+
assert_equal fixture["id"], json[:id]
|
|
1715
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1716
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1717
|
+
end
|
|
1718
|
+
|
|
1719
|
+
def test_user_deleted_round_trip
|
|
1720
|
+
fixture = {
|
|
1721
|
+
"object" => "event",
|
|
1722
|
+
"id" => "stub",
|
|
1723
|
+
"event" => "user.deleted",
|
|
1724
|
+
"data" => {},
|
|
1725
|
+
"created_at" => "stub",
|
|
1726
|
+
"context" => {}
|
|
1727
|
+
}
|
|
1728
|
+
model = WorkOS::UserDeleted.new(fixture.to_json)
|
|
1729
|
+
json = model.to_h
|
|
1730
|
+
assert_kind_of Hash, json
|
|
1731
|
+
assert_equal fixture["id"], json[:id]
|
|
1732
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1733
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1734
|
+
end
|
|
1735
|
+
|
|
1736
|
+
def test_user_updated_round_trip
|
|
1737
|
+
fixture = {
|
|
1738
|
+
"object" => "event",
|
|
1739
|
+
"id" => "stub",
|
|
1740
|
+
"event" => "user.updated",
|
|
1741
|
+
"data" => {},
|
|
1742
|
+
"created_at" => "stub",
|
|
1743
|
+
"context" => {}
|
|
1744
|
+
}
|
|
1745
|
+
model = WorkOS::UserUpdated.new(fixture.to_json)
|
|
1746
|
+
json = model.to_h
|
|
1747
|
+
assert_kind_of Hash, json
|
|
1748
|
+
assert_equal fixture["id"], json[:id]
|
|
1749
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1750
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1751
|
+
end
|
|
1752
|
+
|
|
1753
|
+
def test_radar_challenge_round_trip
|
|
1754
|
+
fixture = {
|
|
1755
|
+
"object" => "radar_challenge",
|
|
1756
|
+
"id" => "stub",
|
|
1757
|
+
"type" => "email",
|
|
1758
|
+
"user_id" => "stub",
|
|
1759
|
+
"email" => "stub",
|
|
1760
|
+
"expires_at" => "stub",
|
|
1761
|
+
"created_at" => "stub",
|
|
1762
|
+
"updated_at" => "stub",
|
|
1763
|
+
"code" => "stub"
|
|
1764
|
+
}
|
|
1765
|
+
model = WorkOS::RadarChallenge.new(fixture.to_json)
|
|
1766
|
+
json = model.to_h
|
|
1767
|
+
assert_kind_of Hash, json
|
|
1768
|
+
assert_equal fixture["id"], json[:id]
|
|
1769
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
1770
|
+
assert_equal fixture["email"], json[:email]
|
|
1771
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
1772
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1773
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
1774
|
+
assert_equal fixture["code"], json[:code]
|
|
1775
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1776
|
+
end
|
|
1777
|
+
|
|
277
1778
|
def test_send_radar_sms_challenge_response_round_trip
|
|
278
1779
|
fixture = {
|
|
279
1780
|
"verification_id" => "stub",
|