workos 9.5.1 → 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 +9 -4
- 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 +83 -3
- 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 +5 -18
- 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 -155
- 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
|
@@ -386,6 +386,243 @@ class AuthorizationModelRoundTripTest < Minitest::Test
|
|
|
386
386
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
387
387
|
end
|
|
388
388
|
|
|
389
|
+
def test_permission_created_round_trip
|
|
390
|
+
fixture = {
|
|
391
|
+
"object" => "event",
|
|
392
|
+
"id" => "stub",
|
|
393
|
+
"event" => "permission.created",
|
|
394
|
+
"data" => {},
|
|
395
|
+
"created_at" => "stub",
|
|
396
|
+
"context" => {}
|
|
397
|
+
}
|
|
398
|
+
model = WorkOS::PermissionCreated.new(fixture.to_json)
|
|
399
|
+
json = model.to_h
|
|
400
|
+
assert_kind_of Hash, json
|
|
401
|
+
assert_equal fixture["id"], json[:id]
|
|
402
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
403
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
404
|
+
end
|
|
405
|
+
|
|
406
|
+
def test_permission_created_data_round_trip
|
|
407
|
+
fixture = {
|
|
408
|
+
"object" => "permission",
|
|
409
|
+
"id" => "stub",
|
|
410
|
+
"slug" => "stub",
|
|
411
|
+
"name" => "stub",
|
|
412
|
+
"description" => nil,
|
|
413
|
+
"system" => true,
|
|
414
|
+
"resource_type_slug" => "stub",
|
|
415
|
+
"created_at" => "stub",
|
|
416
|
+
"updated_at" => "stub"
|
|
417
|
+
}
|
|
418
|
+
model = WorkOS::PermissionCreatedData.new(fixture.to_json)
|
|
419
|
+
json = model.to_h
|
|
420
|
+
assert_kind_of Hash, json
|
|
421
|
+
assert_equal fixture["id"], json[:id]
|
|
422
|
+
assert_equal fixture["slug"], json[:slug]
|
|
423
|
+
assert_equal fixture["name"], json[:name]
|
|
424
|
+
assert_nil json[:description]
|
|
425
|
+
assert_equal fixture["system"], json[:system]
|
|
426
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
427
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
428
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
429
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
def test_permission_deleted_round_trip
|
|
433
|
+
fixture = {
|
|
434
|
+
"object" => "event",
|
|
435
|
+
"id" => "stub",
|
|
436
|
+
"event" => "permission.deleted",
|
|
437
|
+
"data" => {},
|
|
438
|
+
"created_at" => "stub",
|
|
439
|
+
"context" => {}
|
|
440
|
+
}
|
|
441
|
+
model = WorkOS::PermissionDeleted.new(fixture.to_json)
|
|
442
|
+
json = model.to_h
|
|
443
|
+
assert_kind_of Hash, json
|
|
444
|
+
assert_equal fixture["id"], json[:id]
|
|
445
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
446
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
447
|
+
end
|
|
448
|
+
|
|
449
|
+
def test_permission_deleted_data_round_trip
|
|
450
|
+
fixture = {
|
|
451
|
+
"object" => "permission",
|
|
452
|
+
"id" => "stub",
|
|
453
|
+
"slug" => "stub",
|
|
454
|
+
"name" => "stub",
|
|
455
|
+
"description" => nil,
|
|
456
|
+
"system" => true,
|
|
457
|
+
"resource_type_slug" => "stub",
|
|
458
|
+
"created_at" => "stub",
|
|
459
|
+
"updated_at" => "stub"
|
|
460
|
+
}
|
|
461
|
+
model = WorkOS::PermissionDeletedData.new(fixture.to_json)
|
|
462
|
+
json = model.to_h
|
|
463
|
+
assert_kind_of Hash, json
|
|
464
|
+
assert_equal fixture["id"], json[:id]
|
|
465
|
+
assert_equal fixture["slug"], json[:slug]
|
|
466
|
+
assert_equal fixture["name"], json[:name]
|
|
467
|
+
assert_nil json[:description]
|
|
468
|
+
assert_equal fixture["system"], json[:system]
|
|
469
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
470
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
471
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
472
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
def test_permission_updated_round_trip
|
|
476
|
+
fixture = {
|
|
477
|
+
"object" => "event",
|
|
478
|
+
"id" => "stub",
|
|
479
|
+
"event" => "permission.updated",
|
|
480
|
+
"data" => {},
|
|
481
|
+
"created_at" => "stub",
|
|
482
|
+
"context" => {}
|
|
483
|
+
}
|
|
484
|
+
model = WorkOS::PermissionUpdated.new(fixture.to_json)
|
|
485
|
+
json = model.to_h
|
|
486
|
+
assert_kind_of Hash, json
|
|
487
|
+
assert_equal fixture["id"], json[:id]
|
|
488
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
489
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
def test_permission_updated_data_round_trip
|
|
493
|
+
fixture = {
|
|
494
|
+
"object" => "permission",
|
|
495
|
+
"id" => "stub",
|
|
496
|
+
"slug" => "stub",
|
|
497
|
+
"name" => "stub",
|
|
498
|
+
"description" => nil,
|
|
499
|
+
"system" => true,
|
|
500
|
+
"resource_type_slug" => "stub",
|
|
501
|
+
"created_at" => "stub",
|
|
502
|
+
"updated_at" => "stub"
|
|
503
|
+
}
|
|
504
|
+
model = WorkOS::PermissionUpdatedData.new(fixture.to_json)
|
|
505
|
+
json = model.to_h
|
|
506
|
+
assert_kind_of Hash, json
|
|
507
|
+
assert_equal fixture["id"], json[:id]
|
|
508
|
+
assert_equal fixture["slug"], json[:slug]
|
|
509
|
+
assert_equal fixture["name"], json[:name]
|
|
510
|
+
assert_nil json[:description]
|
|
511
|
+
assert_equal fixture["system"], json[:system]
|
|
512
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
513
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
514
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
515
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
def test_role_created_round_trip
|
|
519
|
+
fixture = {
|
|
520
|
+
"object" => "event",
|
|
521
|
+
"id" => "stub",
|
|
522
|
+
"event" => "role.created",
|
|
523
|
+
"data" => {},
|
|
524
|
+
"created_at" => "stub",
|
|
525
|
+
"context" => {}
|
|
526
|
+
}
|
|
527
|
+
model = WorkOS::RoleCreated.new(fixture.to_json)
|
|
528
|
+
json = model.to_h
|
|
529
|
+
assert_kind_of Hash, json
|
|
530
|
+
assert_equal fixture["id"], json[:id]
|
|
531
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
532
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
533
|
+
end
|
|
534
|
+
|
|
535
|
+
def test_role_created_data_round_trip
|
|
536
|
+
fixture = {
|
|
537
|
+
"object" => "role",
|
|
538
|
+
"slug" => "stub",
|
|
539
|
+
"resource_type_slug" => "stub",
|
|
540
|
+
"permissions" => [],
|
|
541
|
+
"created_at" => "stub",
|
|
542
|
+
"updated_at" => "stub"
|
|
543
|
+
}
|
|
544
|
+
model = WorkOS::RoleCreatedData.new(fixture.to_json)
|
|
545
|
+
json = model.to_h
|
|
546
|
+
assert_kind_of Hash, json
|
|
547
|
+
assert_equal fixture["slug"], json[:slug]
|
|
548
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
549
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
550
|
+
assert_equal fixture["updated_at"], json[:updated_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_role_deleted_round_trip
|
|
555
|
+
fixture = {
|
|
556
|
+
"object" => "event",
|
|
557
|
+
"id" => "stub",
|
|
558
|
+
"event" => "role.deleted",
|
|
559
|
+
"data" => {},
|
|
560
|
+
"created_at" => "stub",
|
|
561
|
+
"context" => {}
|
|
562
|
+
}
|
|
563
|
+
model = WorkOS::RoleDeleted.new(fixture.to_json)
|
|
564
|
+
json = model.to_h
|
|
565
|
+
assert_kind_of Hash, json
|
|
566
|
+
assert_equal fixture["id"], json[:id]
|
|
567
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
568
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
569
|
+
end
|
|
570
|
+
|
|
571
|
+
def test_role_deleted_data_round_trip
|
|
572
|
+
fixture = {
|
|
573
|
+
"object" => "role",
|
|
574
|
+
"slug" => "stub",
|
|
575
|
+
"resource_type_slug" => "stub",
|
|
576
|
+
"permissions" => [],
|
|
577
|
+
"created_at" => "stub",
|
|
578
|
+
"updated_at" => "stub"
|
|
579
|
+
}
|
|
580
|
+
model = WorkOS::RoleDeletedData.new(fixture.to_json)
|
|
581
|
+
json = model.to_h
|
|
582
|
+
assert_kind_of Hash, json
|
|
583
|
+
assert_equal fixture["slug"], json[:slug]
|
|
584
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
585
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
586
|
+
assert_equal fixture["updated_at"], json[:updated_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_role_updated_round_trip
|
|
591
|
+
fixture = {
|
|
592
|
+
"object" => "event",
|
|
593
|
+
"id" => "stub",
|
|
594
|
+
"event" => "role.updated",
|
|
595
|
+
"data" => {},
|
|
596
|
+
"created_at" => "stub",
|
|
597
|
+
"context" => {}
|
|
598
|
+
}
|
|
599
|
+
model = WorkOS::RoleUpdated.new(fixture.to_json)
|
|
600
|
+
json = model.to_h
|
|
601
|
+
assert_kind_of Hash, json
|
|
602
|
+
assert_equal fixture["id"], json[:id]
|
|
603
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
604
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
605
|
+
end
|
|
606
|
+
|
|
607
|
+
def test_role_updated_data_round_trip
|
|
608
|
+
fixture = {
|
|
609
|
+
"object" => "role",
|
|
610
|
+
"slug" => "stub",
|
|
611
|
+
"resource_type_slug" => "stub",
|
|
612
|
+
"permissions" => [],
|
|
613
|
+
"created_at" => "stub",
|
|
614
|
+
"updated_at" => "stub"
|
|
615
|
+
}
|
|
616
|
+
model = WorkOS::RoleUpdatedData.new(fixture.to_json)
|
|
617
|
+
json = model.to_h
|
|
618
|
+
assert_kind_of Hash, json
|
|
619
|
+
assert_equal fixture["slug"], json[:slug]
|
|
620
|
+
assert_equal fixture["resource_type_slug"], json[:resource_type_slug]
|
|
621
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
622
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
623
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
624
|
+
end
|
|
625
|
+
|
|
389
626
|
def test_user_role_assignment_resource_round_trip
|
|
390
627
|
fixture = {
|
|
391
628
|
"id" => "stub",
|
|
@@ -82,24 +82,6 @@ class BaseClientTest < Minitest::Test
|
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
# A pooled connection that either returns a canned response or raises when
|
|
86
|
-
# driven, so execute_request can be exercised without real TCP+TLS.
|
|
87
|
-
class StubConnection < FakeConnection
|
|
88
|
-
attr_accessor :read_timeout, :open_timeout
|
|
89
|
-
|
|
90
|
-
def initialize(response: nil, error: nil, **kwargs)
|
|
91
|
-
super(**kwargs)
|
|
92
|
-
@response = response
|
|
93
|
-
@error = error
|
|
94
|
-
end
|
|
95
|
-
|
|
96
|
-
def request(_request)
|
|
97
|
-
raise @error if @error
|
|
98
|
-
|
|
99
|
-
@response
|
|
100
|
-
end
|
|
101
|
-
end
|
|
102
|
-
|
|
103
85
|
def setup
|
|
104
86
|
@client = WorkOS::BaseClient.new(api_key: "sk_test_123", max_retries: 1)
|
|
105
87
|
end
|
|
@@ -137,6 +119,33 @@ class BaseClientTest < Minitest::Test
|
|
|
137
119
|
assert_equal "idem_123", request["Idempotency-Key"]
|
|
138
120
|
end
|
|
139
121
|
|
|
122
|
+
# The body is serialized verbatim (no `.compact`), so an explicit `nil` is
|
|
123
|
+
# sent as JSON `null` — this is what lets generated methods clear a nullable
|
|
124
|
+
# field. Omission is handled upstream in the generated method, not here.
|
|
125
|
+
def test_put_request_serializes_explicit_nil_as_json_null
|
|
126
|
+
request = @client.put_request(path: "/widgets/w_1", auth: true, body: {"external_id" => nil})
|
|
127
|
+
|
|
128
|
+
assert_equal({"external_id" => nil}, JSON.parse(request.body))
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
def test_post_request_serializes_explicit_nil_as_json_null
|
|
132
|
+
request = @client.post_request(path: "/widgets", auth: true, body: {"external_id" => nil})
|
|
133
|
+
|
|
134
|
+
assert_equal({"external_id" => nil}, JSON.parse(request.body))
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
def test_patch_request_serializes_explicit_nil_as_json_null
|
|
138
|
+
request = @client.patch_request(path: "/widgets/w_1", auth: true, body: {"external_id" => nil})
|
|
139
|
+
|
|
140
|
+
assert_equal({"external_id" => nil}, JSON.parse(request.body))
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
def test_delete_request_serializes_explicit_nil_as_json_null
|
|
144
|
+
request = @client.delete_request(path: "/widgets/w_1", auth: true, body: {"external_id" => nil})
|
|
145
|
+
|
|
146
|
+
assert_equal({"external_id" => nil}, JSON.parse(request.body))
|
|
147
|
+
end
|
|
148
|
+
|
|
140
149
|
def test_retry_path_generates_idempotency_key_for_mutating_requests
|
|
141
150
|
stub_request(:post, "https://api.workos.com/widgets")
|
|
142
151
|
.to_return({status: 500, body: '{"message":"retry"}'}, {status: 200, body: "{}"})
|
|
@@ -197,143 +206,6 @@ class BaseClientTest < Minitest::Test
|
|
|
197
206
|
refute keep.finished
|
|
198
207
|
end
|
|
199
208
|
|
|
200
|
-
# An exception execute_request's rescue clause doesn't list still leaves the
|
|
201
|
-
# socket mid-stream, so the connection must not survive in the pool for the
|
|
202
|
-
# next request on this thread to pick up.
|
|
203
|
-
def test_unlisted_request_error_evicts_the_pooled_connection
|
|
204
|
-
conn = StubConnection.new(error: Net::HTTPBadResponse.new("wrong version"))
|
|
205
|
-
cache = @client.send(:thread_connections)
|
|
206
|
-
cache["https:api.workos.com:443:30"] = conn
|
|
207
|
-
|
|
208
|
-
assert_raises(Net::HTTPBadResponse) do
|
|
209
|
-
@client.execute_request(request: Net::HTTP::Get.new("/things"))
|
|
210
|
-
end
|
|
211
|
-
|
|
212
|
-
refute cache.key?("https:api.workos.com:443:30"),
|
|
213
|
-
"a connection whose request did not complete must not stay pooled"
|
|
214
|
-
assert conn.finished
|
|
215
|
-
end
|
|
216
|
-
|
|
217
|
-
def test_completed_request_keeps_the_connection_pooled
|
|
218
|
-
conn = StubConnection.new(response: Net::HTTPOK.new("1.1", "200", "OK"))
|
|
219
|
-
cache = @client.send(:thread_connections)
|
|
220
|
-
cache["https:api.workos.com:443:30"] = conn
|
|
221
|
-
|
|
222
|
-
@client.execute_request(request: Net::HTTP::Get.new("/things"))
|
|
223
|
-
|
|
224
|
-
assert cache.key?("https:api.workos.com:443:30")
|
|
225
|
-
refute conn.finished
|
|
226
|
-
end
|
|
227
|
-
|
|
228
|
-
# Raised asynchronously into the worker thread to stand in for a caller-side
|
|
229
|
-
# abort: Timeout.timeout, Thread#kill, a signal handler unwinding the stack.
|
|
230
|
-
# It descends from Exception rather than StandardError so that nothing in
|
|
231
|
-
# execute_request can catch it — the `ensure` is the only cleanup that runs.
|
|
232
|
-
class AbortSignal < Exception; end # standard:disable Lint/InheritException
|
|
233
|
-
|
|
234
|
-
# End-to-end regression test over a real keep-alive socket, for the failure
|
|
235
|
-
# the eviction actually prevents: request one is abandoned mid-flight, the
|
|
236
|
-
# server then writes response one onto that socket, and request two on the
|
|
237
|
-
# same thread reads those stale bytes as if they were its own response.
|
|
238
|
-
#
|
|
239
|
-
# Before the fix, request two sees marker "one" (or a mangled response) off
|
|
240
|
-
# the pooled socket. After it, the abandoned socket is closed and the server
|
|
241
|
-
# accepts a fresh connection for request two.
|
|
242
|
-
def test_aborted_request_does_not_leak_its_response_to_the_next_request
|
|
243
|
-
WebMock.disable!
|
|
244
|
-
server = TCPServer.new("127.0.0.1", 0)
|
|
245
|
-
port = server.addr[1]
|
|
246
|
-
client = WorkOS::BaseClient.new(
|
|
247
|
-
api_key: "sk_test_123",
|
|
248
|
-
base_url: "http://127.0.0.1:#{port}",
|
|
249
|
-
timeout: 5,
|
|
250
|
-
max_retries: 0
|
|
251
|
-
)
|
|
252
|
-
|
|
253
|
-
request_one_read = Queue.new
|
|
254
|
-
release_response_one = Queue.new
|
|
255
|
-
response_one_written = Queue.new
|
|
256
|
-
aborted = Queue.new
|
|
257
|
-
connections = Queue.new
|
|
258
|
-
|
|
259
|
-
server_thread = Thread.new do
|
|
260
|
-
# Connection one: read the request, then hold the response back until
|
|
261
|
-
# the client has been aborted and has unwound.
|
|
262
|
-
first = server.accept
|
|
263
|
-
connections << first
|
|
264
|
-
read_http_request(first)
|
|
265
|
-
request_one_read << true
|
|
266
|
-
release_response_one.pop
|
|
267
|
-
begin
|
|
268
|
-
write_http_response(first, {marker: "one"})
|
|
269
|
-
rescue Errno::EPIPE, Errno::ECONNRESET, IOError
|
|
270
|
-
# Expected once the fix closes the abandoned socket.
|
|
271
|
-
end
|
|
272
|
-
response_one_written << true
|
|
273
|
-
|
|
274
|
-
# Connection two: a fresh accept, which only completes because the
|
|
275
|
-
# client did not reuse the socket above.
|
|
276
|
-
second = server.accept
|
|
277
|
-
connections << second
|
|
278
|
-
read_http_request(second)
|
|
279
|
-
write_http_response(second, {marker: "two"})
|
|
280
|
-
end
|
|
281
|
-
|
|
282
|
-
worker = Thread.new do
|
|
283
|
-
begin
|
|
284
|
-
client.execute_request(request: Net::HTTP::Get.new("/one"))
|
|
285
|
-
rescue AbortSignal
|
|
286
|
-
# The caller unwinds but the thread survives and goes on to serve more
|
|
287
|
-
# work, the way a Puma or Solid Queue worker does. execute_request's
|
|
288
|
-
# `ensure` has already run by the time this body executes.
|
|
289
|
-
aborted << true
|
|
290
|
-
response_one_written.pop
|
|
291
|
-
end
|
|
292
|
-
response = client.execute_request(request: Net::HTTP::Get.new("/two"))
|
|
293
|
-
JSON.parse(response.body)["marker"]
|
|
294
|
-
end
|
|
295
|
-
|
|
296
|
-
marker = Timeout.timeout(15) do
|
|
297
|
-
request_one_read.pop
|
|
298
|
-
worker.raise(AbortSignal)
|
|
299
|
-
aborted.pop
|
|
300
|
-
release_response_one << true
|
|
301
|
-
worker.value
|
|
302
|
-
end
|
|
303
|
-
|
|
304
|
-
assert_equal "two", marker,
|
|
305
|
-
"request two read the abandoned socket's response instead of its own"
|
|
306
|
-
ensure
|
|
307
|
-
server_thread&.kill
|
|
308
|
-
worker&.kill
|
|
309
|
-
until connections.nil? || connections.empty?
|
|
310
|
-
socket = connections.pop
|
|
311
|
-
socket.close unless socket.closed?
|
|
312
|
-
end
|
|
313
|
-
server&.close
|
|
314
|
-
WebMock.enable!
|
|
315
|
-
end
|
|
316
|
-
|
|
317
|
-
def read_http_request(socket)
|
|
318
|
-
socket.gets # request line
|
|
319
|
-
loop do
|
|
320
|
-
line = socket.gets
|
|
321
|
-
break if line.nil? || line == "\r\n"
|
|
322
|
-
end
|
|
323
|
-
end
|
|
324
|
-
|
|
325
|
-
def write_http_response(socket, body)
|
|
326
|
-
payload = JSON.generate(body)
|
|
327
|
-
socket.write(
|
|
328
|
-
"HTTP/1.1 200 OK\r\n" \
|
|
329
|
-
"Content-Type: application/json\r\n" \
|
|
330
|
-
"Content-Length: #{payload.bytesize}\r\n" \
|
|
331
|
-
"Connection: keep-alive\r\n" \
|
|
332
|
-
"\r\n#{payload}"
|
|
333
|
-
)
|
|
334
|
-
socket.flush
|
|
335
|
-
end
|
|
336
|
-
|
|
337
209
|
# Regression test for https://github.com/workos/workos-ruby/issues/496
|
|
338
210
|
#
|
|
339
211
|
# The connection cache must be isolated per thread. A previous version
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "test_helper"
|
|
6
|
+
|
|
7
|
+
class ClientApiModelRoundTripTest < Minitest::Test
|
|
8
|
+
def test_client_api_token_round_trip
|
|
9
|
+
fixture = {
|
|
10
|
+
"organization_id" => "stub",
|
|
11
|
+
"user_id" => "stub"
|
|
12
|
+
}
|
|
13
|
+
model = WorkOS::ClientApiToken.new(fixture.to_json)
|
|
14
|
+
json = model.to_h
|
|
15
|
+
assert_kind_of Hash, json
|
|
16
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
17
|
+
assert_equal fixture["user_id"], json[:user_id]
|
|
18
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_client_api_token_response_round_trip
|
|
22
|
+
fixture = {
|
|
23
|
+
"token" => "stub"
|
|
24
|
+
}
|
|
25
|
+
model = WorkOS::ClientApiTokenResponse.new(fixture.to_json)
|
|
26
|
+
json = model.to_h
|
|
27
|
+
assert_kind_of Hash, json
|
|
28
|
+
assert_equal fixture["token"], json[:token]
|
|
29
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
30
|
+
end
|
|
31
|
+
end
|
|
@@ -5,6 +5,128 @@
|
|
|
5
5
|
require "test_helper"
|
|
6
6
|
|
|
7
7
|
class ConnectModelRoundTripTest < Minitest::Test
|
|
8
|
+
def test_user_object_round_trip
|
|
9
|
+
fixture = {
|
|
10
|
+
"id" => "stub",
|
|
11
|
+
"email" => "stub",
|
|
12
|
+
"first_name" => "stub",
|
|
13
|
+
"last_name" => "stub",
|
|
14
|
+
"name" => "stub",
|
|
15
|
+
"metadata" => {}
|
|
16
|
+
}
|
|
17
|
+
model = WorkOS::UserObject.new(fixture.to_json)
|
|
18
|
+
json = model.to_h
|
|
19
|
+
assert_kind_of Hash, json
|
|
20
|
+
assert_equal fixture["id"], json[:id]
|
|
21
|
+
assert_equal fixture["email"], json[:email]
|
|
22
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def test_user_consent_option_round_trip
|
|
26
|
+
fixture = {
|
|
27
|
+
"claim" => "stub",
|
|
28
|
+
"type" => "enum",
|
|
29
|
+
"label" => "stub",
|
|
30
|
+
"choices" => []
|
|
31
|
+
}
|
|
32
|
+
model = WorkOS::UserConsentOption.new(fixture.to_json)
|
|
33
|
+
json = model.to_h
|
|
34
|
+
assert_kind_of Hash, json
|
|
35
|
+
assert_equal fixture["claim"], json[:claim]
|
|
36
|
+
assert_equal fixture["label"], json[:label]
|
|
37
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
def test_user_management_login_request_round_trip
|
|
41
|
+
fixture = {
|
|
42
|
+
"external_auth_id" => "stub",
|
|
43
|
+
"user" => {},
|
|
44
|
+
"user_consent_options" => []
|
|
45
|
+
}
|
|
46
|
+
model = WorkOS::UserManagementLoginRequest.new(fixture.to_json)
|
|
47
|
+
json = model.to_h
|
|
48
|
+
assert_kind_of Hash, json
|
|
49
|
+
assert_equal fixture["external_auth_id"], json[:external_auth_id]
|
|
50
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def test_redirect_uri_input_round_trip
|
|
54
|
+
fixture = {
|
|
55
|
+
"uri" => "stub",
|
|
56
|
+
"default" => nil
|
|
57
|
+
}
|
|
58
|
+
model = WorkOS::RedirectUriInput.new(fixture.to_json)
|
|
59
|
+
json = model.to_h
|
|
60
|
+
assert_kind_of Hash, json
|
|
61
|
+
assert_equal fixture["uri"], json[:uri]
|
|
62
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def test_create_oauth_application_round_trip
|
|
66
|
+
fixture = {
|
|
67
|
+
"name" => "stub",
|
|
68
|
+
"application_type" => "oauth",
|
|
69
|
+
"description" => nil,
|
|
70
|
+
"scopes" => nil,
|
|
71
|
+
"redirect_uris" => nil,
|
|
72
|
+
"uses_pkce" => nil,
|
|
73
|
+
"is_first_party" => true,
|
|
74
|
+
"organization_id" => nil
|
|
75
|
+
}
|
|
76
|
+
model = WorkOS::CreateOAuthApplication.new(fixture.to_json)
|
|
77
|
+
json = model.to_h
|
|
78
|
+
assert_kind_of Hash, json
|
|
79
|
+
assert_equal fixture["name"], json[:name]
|
|
80
|
+
assert_equal fixture["is_first_party"], json[:is_first_party]
|
|
81
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def test_create_m2m_application_round_trip
|
|
85
|
+
fixture = {
|
|
86
|
+
"name" => "stub",
|
|
87
|
+
"application_type" => "m2m",
|
|
88
|
+
"description" => nil,
|
|
89
|
+
"scopes" => nil,
|
|
90
|
+
"organization_id" => "stub"
|
|
91
|
+
}
|
|
92
|
+
model = WorkOS::CreateM2MApplication.new(fixture.to_json)
|
|
93
|
+
json = model.to_h
|
|
94
|
+
assert_kind_of Hash, json
|
|
95
|
+
assert_equal fixture["name"], json[:name]
|
|
96
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
97
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
def test_update_oauth_application_round_trip
|
|
101
|
+
fixture = {
|
|
102
|
+
"name" => "stub",
|
|
103
|
+
"description" => nil,
|
|
104
|
+
"scopes" => nil,
|
|
105
|
+
"redirect_uris" => nil
|
|
106
|
+
}
|
|
107
|
+
model = WorkOS::UpdateOAuthApplication.new(fixture.to_json)
|
|
108
|
+
json = model.to_h
|
|
109
|
+
assert_kind_of Hash, json
|
|
110
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
def test_create_application_secret_round_trip
|
|
114
|
+
model = WorkOS::CreateApplicationSecret.new("{}")
|
|
115
|
+
json = model.to_h
|
|
116
|
+
assert_kind_of Hash, json
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def test_external_auth_complete_response_round_trip
|
|
120
|
+
fixture = {
|
|
121
|
+
"redirect_uri" => "stub"
|
|
122
|
+
}
|
|
123
|
+
model = WorkOS::ExternalAuthCompleteResponse.new(fixture.to_json)
|
|
124
|
+
json = model.to_h
|
|
125
|
+
assert_kind_of Hash, json
|
|
126
|
+
assert_equal fixture["redirect_uri"], json[:redirect_uri]
|
|
127
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
128
|
+
end
|
|
129
|
+
|
|
8
130
|
def test_connect_application_round_trip
|
|
9
131
|
fixture = {
|
|
10
132
|
"object" => "connect_application",
|
|
@@ -27,4 +149,57 @@ class ConnectModelRoundTripTest < Minitest::Test
|
|
|
27
149
|
assert_equal fixture["updated_at"], json[:updated_at]
|
|
28
150
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
29
151
|
end
|
|
152
|
+
|
|
153
|
+
def test_new_connect_application_secret_round_trip
|
|
154
|
+
fixture = {
|
|
155
|
+
"object" => "connect_application_secret",
|
|
156
|
+
"id" => "stub",
|
|
157
|
+
"secret_hint" => "stub",
|
|
158
|
+
"last_used_at" => nil,
|
|
159
|
+
"created_at" => "stub",
|
|
160
|
+
"updated_at" => "stub",
|
|
161
|
+
"secret" => "stub"
|
|
162
|
+
}
|
|
163
|
+
model = WorkOS::NewConnectApplicationSecret.new(fixture.to_json)
|
|
164
|
+
json = model.to_h
|
|
165
|
+
assert_kind_of Hash, json
|
|
166
|
+
assert_equal fixture["id"], json[:id]
|
|
167
|
+
assert_equal fixture["secret_hint"], json[:secret_hint]
|
|
168
|
+
assert_nil json[:last_used_at]
|
|
169
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
170
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
171
|
+
assert_equal fixture["secret"], json[:secret]
|
|
172
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
173
|
+
end
|
|
174
|
+
|
|
175
|
+
def test_user_consent_option_choice_round_trip
|
|
176
|
+
fixture = {
|
|
177
|
+
"value" => "stub",
|
|
178
|
+
"label" => "stub"
|
|
179
|
+
}
|
|
180
|
+
model = WorkOS::UserConsentOptionChoice.new(fixture.to_json)
|
|
181
|
+
json = model.to_h
|
|
182
|
+
assert_kind_of Hash, json
|
|
183
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
def test_application_credentials_list_item_round_trip
|
|
187
|
+
fixture = {
|
|
188
|
+
"object" => "connect_application_secret",
|
|
189
|
+
"id" => "stub",
|
|
190
|
+
"secret_hint" => "stub",
|
|
191
|
+
"last_used_at" => nil,
|
|
192
|
+
"created_at" => "stub",
|
|
193
|
+
"updated_at" => "stub"
|
|
194
|
+
}
|
|
195
|
+
model = WorkOS::ApplicationCredentialsListItem.new(fixture.to_json)
|
|
196
|
+
json = model.to_h
|
|
197
|
+
assert_kind_of Hash, json
|
|
198
|
+
assert_equal fixture["id"], json[:id]
|
|
199
|
+
assert_equal fixture["secret_hint"], json[:secret_hint]
|
|
200
|
+
assert_nil json[:last_used_at]
|
|
201
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
202
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
203
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
204
|
+
end
|
|
30
205
|
end
|