workos 10.2.1 → 10.4.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/ci.yml +2 -2
- data/.github/workflows/docs.yml +3 -3
- data/.github/workflows/lint.yml +2 -2
- data/.github/workflows/release-please.yml +3 -3
- data/.github/workflows/release.yml +2 -2
- data/.last-synced-sha +1 -1
- data/.oagen-manifest.json +393 -4
- data/.release-please-manifest.json +1 -1
- data/.ruby-version +1 -1
- data/CHANGELOG.md +328 -0
- data/Gemfile.lock +14 -14
- data/README.md +23 -0
- data/lib/workos/admin_portal.rb +2 -2
- data/lib/workos/agents/agent_blueprint.rb +43 -0
- data/lib/workos/agents/agent_blueprint_invocable_by.rb +7 -0
- data/lib/workos/agents/agent_blueprint_session_setting.rb +25 -0
- data/lib/workos/agents/agent_blueprints_create_request.rb +31 -0
- data/lib/workos/agents/agent_blueprints_create_request_invocable_by.rb +22 -0
- data/lib/workos/agents/agent_blueprints_create_request_session_setting.rb +7 -0
- data/lib/workos/agents/agent_blueprints_token_mint_token_request.rb +34 -0
- data/lib/workos/agents/agent_blueprints_token_validate_token_request.rb +18 -0
- data/lib/workos/agents/agent_blueprints_update_request.rb +31 -0
- data/lib/workos/agents/agent_blueprints_update_request_invocable_by.rb +7 -0
- data/lib/workos/agents/agent_blueprints_update_request_session_setting.rb +25 -0
- data/lib/workos/agents/agent_instance.rb +40 -0
- data/lib/workos/agents/agent_instance_session.rb +40 -0
- data/lib/workos/agents/agent_token.rb +40 -0
- data/lib/workos/agents/agent_token_validation.rb +40 -0
- data/lib/workos/agents.rb +399 -0
- data/lib/workos/audit_logs.rb +23 -5
- data/lib/workos/authorization.rb +3 -3
- data/lib/workos/base_client.rb +6 -2
- data/lib/workos/client.rb +4 -0
- data/lib/workos/configuration.rb +3 -2
- data/lib/workos/inflections.rb +17 -0
- data/lib/workos/multi_factor_auth.rb +1 -1
- data/lib/workos/organizations/create_it_contact.rb +18 -0
- data/lib/workos/organizations/invite_it_contact.rb +18 -0
- data/lib/workos/organizations/it_contact.rb +31 -0
- data/lib/workos/organizations/it_contact_list.rb +25 -0
- data/lib/workos/organizations/organization_input.rb +10 -1
- data/lib/workos/organizations/update_audit_logs_retention.rb +13 -1
- data/lib/workos/organizations.rb +110 -1
- data/lib/workos/pipes/connected_account.rb +9 -0
- data/lib/workos/pipes/create_data_integration.rb +3 -0
- data/lib/workos/pipes/data_integration.rb +3 -0
- data/lib/workos/pipes/data_integration_installation.rb +9 -0
- data/lib/workos/pipes/data_integrations_get_data_integration_authorize_url_request.rb +3 -0
- data/lib/workos/pipes/data_integrations_get_user_token_request.rb +11 -2
- data/lib/workos/pipes/data_integrations_list_response_data.rb +18 -3
- data/lib/workos/pipes/data_integrations_list_response_data_connected_account.rb +9 -0
- data/lib/workos/pipes/data_integrations_upsert_api_key_request.rb +25 -1
- data/lib/workos/pipes/data_integrations_upsert_client_credentials_request.rb +6 -0
- data/lib/workos/pipes/data_integrations_vend_credentials_request.rb +11 -2
- data/lib/workos/pipes.rb +324 -17
- data/lib/workos/platform_teams/create_team.rb +22 -0
- data/lib/workos/platform_teams/team.rb +37 -0
- data/lib/workos/platform_teams.rb +58 -0
- data/lib/workos/session_manager.rb +11 -6
- data/lib/workos/shared/account_selection_required_error.rb +22 -0
- data/lib/workos/shared/agent_blueprint_created.rb +34 -0
- data/lib/workos/shared/agent_blueprint_created_data.rb +43 -0
- data/lib/workos/shared/agent_blueprint_created_data_invocable_by.rb +22 -0
- data/lib/workos/shared/agent_blueprint_created_data_session_setting.rb +25 -0
- data/lib/workos/shared/agent_blueprint_deleted.rb +34 -0
- data/lib/workos/shared/agent_blueprint_deleted_data.rb +31 -0
- data/lib/workos/shared/agent_blueprint_updated.rb +34 -0
- data/lib/workos/shared/agent_blueprint_updated_data.rb +7 -0
- data/lib/workos/shared/agent_blueprint_updated_data_invocable_by.rb +7 -0
- data/lib/workos/shared/agent_blueprint_updated_data_session_setting.rb +7 -0
- data/lib/workos/shared/agent_instance_created.rb +34 -0
- data/lib/workos/shared/agent_instance_created_data.rb +40 -0
- data/lib/workos/shared/agent_instance_deleted.rb +34 -0
- data/lib/workos/shared/agent_instance_deleted_data.rb +40 -0
- data/lib/workos/shared/agent_instance_session_created.rb +34 -0
- data/lib/workos/shared/agent_instance_session_created_data.rb +43 -0
- data/lib/workos/shared/agent_instance_session_revoked.rb +34 -0
- data/lib/workos/shared/agent_instance_session_revoked_data.rb +40 -0
- data/lib/workos/shared/pipe_connected_account.rb +15 -0
- data/lib/workos/shared/pipes_account_connection_add_failed.rb +34 -0
- data/lib/workos/shared/pipes_account_connection_add_failed_data.rb +49 -0
- data/lib/workos/shared/pipes_account_connection_connected.rb +34 -0
- data/lib/workos/shared/pipes_account_connection_connection_failed.rb +34 -0
- data/lib/workos/shared/pipes_account_connection_connection_failed_data.rb +7 -0
- data/lib/workos/shared/pipes_account_connection_disconnected.rb +34 -0
- data/lib/workos/shared/pipes_account_connection_reauthorization_needed.rb +34 -0
- data/lib/workos/shared/pipes_connected_account_connection_failed_data.rb +1 -40
- data/lib/workos/shared/resource_export_completed.rb +34 -0
- data/lib/workos/shared/resource_export_completed_data.rb +22 -0
- data/lib/workos/shared/resource_export_created.rb +34 -0
- data/lib/workos/shared/resource_export_created_data.rb +22 -0
- data/lib/workos/shared/resource_export_downloaded.rb +34 -0
- data/lib/workos/shared/resource_export_downloaded_data.rb +22 -0
- data/lib/workos/shared/resource_export_failed.rb +34 -0
- data/lib/workos/shared/resource_export_failed_data.rb +22 -0
- data/lib/workos/shared/waitlist_user.rb +8 -5
- data/lib/workos/sso/create_connection.rb +37 -0
- data/lib/workos/sso/create_connection_attribute_maps.rb +22 -0
- data/lib/workos/sso/create_connection_key_pair.rb +22 -0
- data/lib/workos/sso/create_connection_oidc_options.rb +43 -0
- data/lib/workos/sso/create_connection_saml_options.rb +40 -0
- data/lib/workos/sso/create_connection_standard_attributes.rb +34 -0
- data/lib/workos/sso/create_saml_idp_signing_certificate.rb +18 -0
- data/lib/workos/sso/patch_connection.rb +34 -0
- data/lib/workos/sso/patch_connection_attribute_maps.rb +22 -0
- data/lib/workos/sso/patch_connection_oidc_options.rb +40 -0
- data/lib/workos/sso/patch_connection_saml_options.rb +31 -0
- data/lib/workos/sso/patch_connection_standard_attributes.rb +7 -0
- data/lib/workos/sso/saml_idp_signing_certificate.rb +34 -0
- data/lib/workos/sso/saml_idp_signing_certificate_list.rb +22 -0
- data/lib/workos/sso/saml_sp_encryption_certificate.rb +34 -0
- data/lib/workos/sso/saml_sp_encryption_certificate_list.rb +22 -0
- data/lib/workos/sso/saml_sp_signing_certificate.rb +34 -0
- data/lib/workos/sso/token_query.rb +11 -2
- data/lib/workos/sso.rb +305 -4
- data/lib/workos/types/agent_blueprints_token_mint_token_request_type.rb +15 -0
- data/lib/workos/types/agent_instance_created_data_type.rb +13 -0
- data/lib/workos/types/agent_instance_deleted_data_type.rb +9 -0
- data/lib/workos/types/agent_instance_session_status.rb +14 -0
- data/lib/workos/types/agent_instance_type.rb +9 -0
- data/lib/workos/types/authenticate_response_authentication_method.rb +1 -4
- data/lib/workos/types/connected_account_connection_role.rb +13 -0
- data/lib/workos/types/connection_activated_data_connection_type.rb +1 -4
- data/lib/workos/types/connection_type.rb +1 -4
- data/lib/workos/types/connections_connection_type.rb +1 -4
- data/lib/workos/types/create_connection_oidc_options_id_token_signature_algorithm.rb +24 -0
- data/lib/workos/types/create_connection_oidc_options_token_authentication_method.rb +14 -0
- data/lib/workos/types/create_data_integration_ownership.rb +13 -0
- data/lib/workos/types/create_webhook_endpoint_events.rb +13 -1
- data/lib/workos/types/data_integration_installation_connection_role.rb +9 -0
- data/lib/workos/types/data_integration_ownership.rb +9 -0
- data/lib/workos/types/data_integrations_get_data_integration_authorize_url_request_connection_owner.rb +9 -0
- data/lib/workos/types/data_integrations_get_user_token_request_connection_owner.rb +9 -0
- data/lib/workos/types/data_integrations_list_response_data_connected_account_connection_role.rb +9 -0
- data/lib/workos/types/data_integrations_list_response_data_connection_owner.rb +9 -0
- data/lib/workos/types/data_integrations_upsert_api_key_request_connection_owner.rb +9 -0
- data/lib/workos/types/data_integrations_upsert_client_credentials_request_connection_owner.rb +9 -0
- data/lib/workos/types/data_integrations_vend_credentials_request_connection_owner.rb +9 -0
- data/lib/workos/types/invite_it_contact_intents.rb +16 -0
- data/lib/workos/types/patch_connection_oidc_options_id_token_signature_algorithm.rb +9 -0
- data/lib/workos/types/patch_connection_oidc_options_token_authentication_method.rb +9 -0
- data/lib/workos/types/pipe_connected_account_auth_method.rb +9 -0
- data/lib/workos/types/pipe_connected_account_connection_role.rb +9 -0
- data/lib/workos/types/pipes_ownership.rb +9 -0
- data/lib/workos/types/resource_export_completed_data_resource_type.rb +18 -0
- data/lib/workos/types/resource_export_created_data_resource_type.rb +9 -0
- data/lib/workos/types/resource_export_downloaded_data_resource_type.rb +9 -0
- data/lib/workos/types/resource_export_failed_data_resource_type.rb +9 -0
- data/lib/workos/types/session_created_data_status.rb +1 -6
- data/lib/workos/types/session_revoked_data_status.rb +1 -1
- data/lib/workos/types/sso_grant_type.rb +13 -0
- data/lib/workos/types/team_production_state.rb +15 -0
- data/lib/workos/types/token_query_grant_type.rb +9 -0
- data/lib/workos/types/update_audit_logs_retention_retention_period.rb +32 -0
- data/lib/workos/types/user_identities_get_item_provider.rb +1 -4
- data/lib/workos/types/user_management_waitlists_state.rb +14 -0
- data/lib/workos/types/user_sessions_status.rb +1 -1
- data/lib/workos/types/waitlist_entry_state.rb +9 -0
- data/lib/workos/types/waitlist_user_state.rb +1 -6
- data/lib/workos/user_management/authentication_oauth_failed_data.rb +5 -2
- data/lib/workos/user_management/authentication_oauth_succeeded_data.rb +5 -2
- data/lib/workos/user_management/authkit_oauth_resource.rb +34 -0
- data/lib/workos/user_management/create_authkit_oauth_resource.rb +22 -0
- data/lib/workos/user_management/create_password_reset_token.rb +1 -12
- data/lib/workos/user_management/create_waitlist_entry.rb +25 -0
- data/lib/workos/user_management/email_completion_session_authenticate_request.rb +43 -0
- data/lib/workos/user_management/waitlist.rb +28 -0
- data/lib/workos/user_management/waitlist_entry.rb +43 -0
- data/lib/workos/user_management.rb +263 -0
- data/lib/workos/version.rb +1 -1
- data/lib/workos.rb +1 -0
- data/rbi/workos/account_selection_required_error.rbi +30 -0
- data/rbi/workos/agent_blueprint.rbi +72 -0
- data/rbi/workos/agent_blueprint_created.rbi +54 -0
- data/rbi/workos/agent_blueprint_created_data.rbi +72 -0
- data/rbi/workos/agent_blueprint_created_data_invocable_by.rbi +30 -0
- data/rbi/workos/agent_blueprint_created_data_session_setting.rbi +36 -0
- data/rbi/workos/agent_blueprint_deleted.rbi +54 -0
- data/rbi/workos/agent_blueprint_deleted_data.rbi +48 -0
- data/rbi/workos/agent_blueprint_invocable_by.rbi +30 -0
- data/rbi/workos/agent_blueprint_session_setting.rbi +36 -0
- data/rbi/workos/agent_blueprint_updated.rbi +54 -0
- data/rbi/workos/agent_blueprint_updated_data.rbi +72 -0
- data/rbi/workos/agent_blueprint_updated_data_invocable_by.rbi +30 -0
- data/rbi/workos/agent_blueprint_updated_data_session_setting.rbi +36 -0
- data/rbi/workos/agent_blueprints_create_request.rbi +48 -0
- data/rbi/workos/agent_blueprints_create_request_invocable_by.rbi +30 -0
- data/rbi/workos/agent_blueprints_create_request_session_setting.rbi +36 -0
- data/rbi/workos/agent_blueprints_token_mint_token_request.rbi +54 -0
- data/rbi/workos/agent_blueprints_token_validate_token_request.rbi +24 -0
- data/rbi/workos/agent_blueprints_update_request.rbi +48 -0
- data/rbi/workos/agent_blueprints_update_request_invocable_by.rbi +30 -0
- data/rbi/workos/agent_blueprints_update_request_session_setting.rbi +36 -0
- data/rbi/workos/agent_instance.rbi +66 -0
- data/rbi/workos/agent_instance_created.rbi +54 -0
- data/rbi/workos/agent_instance_created_data.rbi +66 -0
- data/rbi/workos/agent_instance_deleted.rbi +54 -0
- data/rbi/workos/agent_instance_deleted_data.rbi +66 -0
- data/rbi/workos/agent_instance_session.rbi +66 -0
- data/rbi/workos/agent_instance_session_created.rbi +54 -0
- data/rbi/workos/agent_instance_session_created_data.rbi +72 -0
- data/rbi/workos/agent_instance_session_revoked.rbi +54 -0
- data/rbi/workos/agent_instance_session_revoked_data.rbi +66 -0
- data/rbi/workos/agent_token.rbi +66 -0
- data/rbi/workos/agent_token_validation.rbi +66 -0
- data/rbi/workos/agents.rbi +134 -0
- data/rbi/workos/audit_logs.rbi +26 -2
- data/rbi/workos/authentication_oauth_failed_data.rbi +6 -0
- data/rbi/workos/authentication_oauth_succeeded_data.rbi +6 -0
- data/rbi/workos/authkit_oauth_resource.rbi +54 -0
- data/rbi/workos/client.rbi +3 -0
- data/rbi/workos/connected_account.rbi +18 -0
- data/rbi/workos/create_authkit_oauth_resource.rbi +30 -0
- data/rbi/workos/create_connection.rbi +60 -0
- data/rbi/workos/create_connection_attribute_maps.rbi +30 -0
- data/rbi/workos/create_connection_key_pair.rbi +30 -0
- data/rbi/workos/create_connection_oidc_options.rbi +72 -0
- data/rbi/workos/create_connection_saml_options.rbi +66 -0
- data/rbi/workos/create_connection_standard_attributes.rbi +54 -0
- data/rbi/workos/create_data_integration.rbi +6 -0
- data/rbi/workos/create_it_contact.rbi +24 -0
- data/rbi/workos/create_saml_idp_signing_certificate.rbi +24 -0
- data/rbi/workos/create_team.rbi +30 -0
- data/rbi/workos/create_waitlist_entry.rbi +36 -0
- data/rbi/workos/data_integration.rbi +6 -0
- data/rbi/workos/data_integration_installation.rbi +19 -1
- data/rbi/workos/data_integrations_get_data_integration_authorize_url_request.rbi +6 -0
- data/rbi/workos/data_integrations_get_user_token_request.rbi +18 -0
- data/rbi/workos/data_integrations_list_response_data.rbi +12 -0
- data/rbi/workos/data_integrations_list_response_data_connected_account.rbi +18 -0
- data/rbi/workos/data_integrations_upsert_api_key_request.rbi +12 -0
- data/rbi/workos/data_integrations_upsert_client_credentials_request.rbi +12 -0
- data/rbi/workos/data_integrations_vend_credentials_request.rbi +18 -0
- data/rbi/workos/email_completion_session_authenticate_request.rbi +72 -0
- data/rbi/workos/invite_it_contact.rbi +24 -0
- data/rbi/workos/it_contact.rbi +48 -0
- data/rbi/workos/organizations.rbi +45 -0
- data/rbi/workos/patch_connection.rbi +54 -0
- data/rbi/workos/patch_connection_attribute_maps.rbi +30 -0
- data/rbi/workos/patch_connection_oidc_options.rbi +66 -0
- data/rbi/workos/patch_connection_saml_options.rbi +48 -0
- data/rbi/workos/patch_connection_standard_attributes.rbi +54 -0
- data/rbi/workos/pipe_connected_account.rbi +30 -0
- data/rbi/workos/pipes.rbi +122 -11
- data/rbi/workos/pipes_account_connection_add_failed.rbi +54 -0
- data/rbi/workos/pipes_account_connection_add_failed_data.rbi +84 -0
- data/rbi/workos/pipes_account_connection_connected.rbi +54 -0
- data/rbi/workos/pipes_account_connection_connection_failed.rbi +54 -0
- data/rbi/workos/pipes_account_connection_connection_failed_data.rbi +84 -0
- data/rbi/workos/pipes_account_connection_disconnected.rbi +54 -0
- data/rbi/workos/pipes_account_connection_reauthorization_needed.rbi +54 -0
- data/rbi/workos/pipes_connected_account_connection_failed_data.rbi +6 -0
- data/rbi/workos/platform_teams.rbi +30 -0
- data/rbi/workos/resource_export_completed.rbi +54 -0
- data/rbi/workos/resource_export_completed_data.rbi +30 -0
- data/rbi/workos/resource_export_created.rbi +54 -0
- data/rbi/workos/resource_export_created_data.rbi +30 -0
- data/rbi/workos/resource_export_downloaded.rbi +54 -0
- data/rbi/workos/resource_export_downloaded_data.rbi +30 -0
- data/rbi/workos/resource_export_failed.rbi +54 -0
- data/rbi/workos/resource_export_failed_data.rbi +30 -0
- data/rbi/workos/saml_idp_signing_certificate.rbi +54 -0
- data/rbi/workos/saml_idp_signing_certificate_list.rbi +30 -0
- data/rbi/workos/saml_sp_encryption_certificate.rbi +54 -0
- data/rbi/workos/saml_sp_encryption_certificate_list.rbi +30 -0
- data/rbi/workos/saml_sp_signing_certificate.rbi +54 -0
- data/rbi/workos/sso.rbi +155 -2
- data/rbi/workos/team.rbi +60 -0
- data/rbi/workos/token_query.rbi +20 -2
- data/rbi/workos/update_audit_logs_retention.rbi +8 -2
- data/rbi/workos/user_management.rbi +92 -0
- data/rbi/workos/waitlist.rbi +42 -0
- data/rbi/workos/waitlist_entry.rbi +72 -0
- data/rbi/workos/waitlist_user.rbi +12 -6
- data/test/workos/test_agents.rb +105 -1
- data/test/workos/test_agents_model_round_trip.rb +245 -0
- data/test/workos/test_audit_logs.rb +11 -2
- data/test/workos/test_authorization.rb +6 -6
- data/test/workos/test_organizations.rb +41 -1
- data/test/workos/test_organizations_model_round_trip.rb +40 -1
- data/test/workos/test_pipes.rb +64 -0
- data/test/workos/test_pipes_model_round_trip.rb +35 -5
- data/test/workos/test_platform_teams.rb +41 -0
- data/test/workos/test_platform_teams_model_round_trip.rb +41 -0
- data/test/workos/test_session.rb +63 -0
- data/test/workos/test_shared_model_round_trip.rb +610 -2
- data/test/workos/test_sso.rb +108 -2
- data/test/workos/test_sso_model_round_trip.rb +262 -2
- data/test/workos/test_user_management.rb +80 -0
- data/test/workos/test_user_management_model_round_trip.rb +110 -2
- metadata +194 -1
data/test/workos/test_sso.rb
CHANGED
|
@@ -18,6 +18,85 @@ class SSOTest < Minitest::Test
|
|
|
18
18
|
assert_kind_of WorkOS::Types::ListStruct, result
|
|
19
19
|
end
|
|
20
20
|
|
|
21
|
+
def test_create_connection_returns_expected_result
|
|
22
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/connections(\?|\z)})
|
|
23
|
+
.with(body: hash_including("organization_id" => "stub", "saml_options" => {}))
|
|
24
|
+
.to_return(body: "{}", status: 200)
|
|
25
|
+
result = @client.sso.create_connection(organization_id: "stub", protocol_options: WorkOS::SSO::CreateProtocolOptionsSAML.new(saml_options: {}))
|
|
26
|
+
refute_nil result
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def test_create_connection_with_protocol_options_oidc_returns_expected_result
|
|
30
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/connections(\?|\z)})
|
|
31
|
+
.with(body: hash_including("organization_id" => "stub", "oidc_options" => {}))
|
|
32
|
+
.to_return(body: "{}", status: 200)
|
|
33
|
+
result = @client.sso.create_connection(organization_id: "stub", protocol_options: WorkOS::SSO::CreateProtocolOptionsOIDC.new(oidc_options: {}))
|
|
34
|
+
refute_nil result
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def test_list_connection_saml_idp_signing_certs_returns_expected_result
|
|
38
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/connections/stub/saml_idp_signing_certs(\?|\z)})
|
|
39
|
+
.to_return(body: "{}", status: 200)
|
|
40
|
+
result = @client.sso.list_connection_saml_idp_signing_certs(connection_id: "stub")
|
|
41
|
+
refute_nil result
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def test_create_connection_saml_idp_signing_cert_returns_expected_result
|
|
45
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/connections/stub/saml_idp_signing_certs(\?|\z)})
|
|
46
|
+
.to_return(body: "{}", status: 200)
|
|
47
|
+
result = @client.sso.create_connection_saml_idp_signing_cert(connection_id: "stub", value: "stub")
|
|
48
|
+
refute_nil result
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
def test_delete_connection_saml_idp_signing_cert_returns_expected_result
|
|
52
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/connections/stub/saml_idp_signing_certs/stub(\?|\z)})
|
|
53
|
+
.to_return(body: "{}", status: 200)
|
|
54
|
+
result = @client.sso.delete_connection_saml_idp_signing_cert(connection_id: "stub", certificate_id: "stub")
|
|
55
|
+
assert_nil result
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def test_list_connection_saml_sp_encryption_certs_returns_expected_result
|
|
59
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_encryption_certs(\?|\z)})
|
|
60
|
+
.to_return(body: "{}", status: 200)
|
|
61
|
+
result = @client.sso.list_connection_saml_sp_encryption_certs(connection_id: "stub")
|
|
62
|
+
refute_nil result
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
def test_create_connection_saml_sp_encryption_cert_returns_expected_result
|
|
66
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_encryption_certs(\?|\z)})
|
|
67
|
+
.to_return(body: "{}", status: 200)
|
|
68
|
+
result = @client.sso.create_connection_saml_sp_encryption_cert(connection_id: "stub")
|
|
69
|
+
refute_nil result
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
def test_delete_connection_saml_sp_encryption_cert_returns_expected_result
|
|
73
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_encryption_certs/stub(\?|\z)})
|
|
74
|
+
.to_return(body: "{}", status: 200)
|
|
75
|
+
result = @client.sso.delete_connection_saml_sp_encryption_cert(connection_id: "stub", certificate_id: "stub")
|
|
76
|
+
assert_nil result
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def test_list_connection_saml_sp_signing_cert_returns_expected_result
|
|
80
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_signing_cert(\?|\z)})
|
|
81
|
+
.to_return(body: "{}", status: 200)
|
|
82
|
+
result = @client.sso.list_connection_saml_sp_signing_cert(connection_id: "stub")
|
|
83
|
+
refute_nil result
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
def test_create_connection_saml_sp_signing_cert_returns_expected_result
|
|
87
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_signing_cert(\?|\z)})
|
|
88
|
+
.to_return(body: "{}", status: 200)
|
|
89
|
+
result = @client.sso.create_connection_saml_sp_signing_cert(connection_id: "stub")
|
|
90
|
+
refute_nil result
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def test_delete_connection_saml_sp_signing_cert_returns_expected_result
|
|
94
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_signing_cert/stub(\?|\z)})
|
|
95
|
+
.to_return(body: "{}", status: 200)
|
|
96
|
+
result = @client.sso.delete_connection_saml_sp_signing_cert(connection_id: "stub", certificate_id: "stub")
|
|
97
|
+
assert_nil result
|
|
98
|
+
end
|
|
99
|
+
|
|
21
100
|
def test_get_connection_returns_expected_result
|
|
22
101
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)})
|
|
23
102
|
.to_return(body: "{}", status: 200)
|
|
@@ -25,6 +104,22 @@ class SSOTest < Minitest::Test
|
|
|
25
104
|
refute_nil result
|
|
26
105
|
end
|
|
27
106
|
|
|
107
|
+
def test_update_connection_returns_expected_result
|
|
108
|
+
stub_request(:patch, %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)})
|
|
109
|
+
.with(body: hash_including("saml_options" => {}))
|
|
110
|
+
.to_return(body: "{}", status: 200)
|
|
111
|
+
result = @client.sso.update_connection(id: "stub", protocol_options: WorkOS::SSO::PatchProtocolOptionsSAML.new(saml_options: {}))
|
|
112
|
+
refute_nil result
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def test_update_connection_with_protocol_options_oidc_returns_expected_result
|
|
116
|
+
stub_request(:patch, %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)})
|
|
117
|
+
.with(body: hash_including("oidc_options" => {}))
|
|
118
|
+
.to_return(body: "{}", status: 200)
|
|
119
|
+
result = @client.sso.update_connection(id: "stub", protocol_options: WorkOS::SSO::PatchProtocolOptionsOIDC.new(oidc_options: {}))
|
|
120
|
+
refute_nil result
|
|
121
|
+
end
|
|
122
|
+
|
|
28
123
|
def test_delete_connection_returns_expected_result
|
|
29
124
|
stub_request(:delete, %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)})
|
|
30
125
|
.to_return(body: "{}", status: 200)
|
|
@@ -49,18 +144,29 @@ class SSOTest < Minitest::Test
|
|
|
49
144
|
def test_get_profile_and_token_returns_expected_result
|
|
50
145
|
stub_request(:post, %r{\Ahttps://api\.workos\.com/sso/token(\?|\z)})
|
|
51
146
|
.to_return(body: "{}", status: 200)
|
|
52
|
-
result = @client.sso.get_profile_and_token
|
|
147
|
+
result = @client.sso.get_profile_and_token
|
|
53
148
|
refute_nil result
|
|
54
149
|
end
|
|
55
150
|
|
|
56
151
|
# Parameterized authentication error tests (one per endpoint).
|
|
57
152
|
[
|
|
58
153
|
{name: :list_connections, verb: :get, url: %r{\Ahttps://api\.workos\.com/connections(\?|\z)}},
|
|
154
|
+
{name: :create_connection, verb: :post, url: %r{\Ahttps://api\.workos\.com/connections(\?|\z)}, args: {organization_id: "stub", protocol_options: WorkOS::SSO::CreateProtocolOptionsSAML.new(saml_options: {})}},
|
|
155
|
+
{name: :list_connection_saml_idp_signing_certs, verb: :get, url: %r{\Ahttps://api\.workos\.com/connections/stub/saml_idp_signing_certs(\?|\z)}, args: {connection_id: "stub"}},
|
|
156
|
+
{name: :create_connection_saml_idp_signing_cert, verb: :post, url: %r{\Ahttps://api\.workos\.com/connections/stub/saml_idp_signing_certs(\?|\z)}, args: {connection_id: "stub", value: "stub"}},
|
|
157
|
+
{name: :delete_connection_saml_idp_signing_cert, verb: :delete, url: %r{\Ahttps://api\.workos\.com/connections/stub/saml_idp_signing_certs/stub(\?|\z)}, args: {connection_id: "stub", certificate_id: "stub"}},
|
|
158
|
+
{name: :list_connection_saml_sp_encryption_certs, verb: :get, url: %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_encryption_certs(\?|\z)}, args: {connection_id: "stub"}},
|
|
159
|
+
{name: :create_connection_saml_sp_encryption_cert, verb: :post, url: %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_encryption_certs(\?|\z)}, args: {connection_id: "stub"}},
|
|
160
|
+
{name: :delete_connection_saml_sp_encryption_cert, verb: :delete, url: %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_encryption_certs/stub(\?|\z)}, args: {connection_id: "stub", certificate_id: "stub"}},
|
|
161
|
+
{name: :list_connection_saml_sp_signing_cert, verb: :get, url: %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_signing_cert(\?|\z)}, args: {connection_id: "stub"}},
|
|
162
|
+
{name: :create_connection_saml_sp_signing_cert, verb: :post, url: %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_signing_cert(\?|\z)}, args: {connection_id: "stub"}},
|
|
163
|
+
{name: :delete_connection_saml_sp_signing_cert, verb: :delete, url: %r{\Ahttps://api\.workos\.com/connections/stub/saml_sp_signing_cert/stub(\?|\z)}, args: {connection_id: "stub", certificate_id: "stub"}},
|
|
59
164
|
{name: :get_connection, verb: :get, url: %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)}, args: {id: "stub"}},
|
|
165
|
+
{name: :update_connection, verb: :patch, url: %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)}, args: {id: "stub", protocol_options: WorkOS::SSO::PatchProtocolOptionsSAML.new(saml_options: {})}},
|
|
60
166
|
{name: :delete_connection, verb: :delete, url: %r{\Ahttps://api\.workos\.com/connections/stub(\?|\z)}, args: {id: "stub"}},
|
|
61
167
|
{name: :authorize_logout, verb: :post, url: %r{\Ahttps://api\.workos\.com/sso/logout/authorize(\?|\z)}, args: {profile_id: "stub"}},
|
|
62
168
|
{name: :get_profile, verb: :get, url: %r{\Ahttps://api\.workos\.com/sso/profile(\?|\z)}},
|
|
63
|
-
{name: :get_profile_and_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/sso/token(\?|\z)}
|
|
169
|
+
{name: :get_profile_and_token, verb: :post, url: %r{\Ahttps://api\.workos\.com/sso/token(\?|\z)}}
|
|
64
170
|
].each do |spec|
|
|
65
171
|
define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
|
|
66
172
|
stub_request(spec[:verb], spec[:url])
|
|
@@ -5,19 +5,197 @@
|
|
|
5
5
|
require "test_helper"
|
|
6
6
|
|
|
7
7
|
class SsoModelRoundTripTest < Minitest::Test
|
|
8
|
+
def test_create_connection_key_pair_round_trip
|
|
9
|
+
fixture = {
|
|
10
|
+
"key" => "stub",
|
|
11
|
+
"cert" => "stub"
|
|
12
|
+
}
|
|
13
|
+
model = WorkOS::CreateConnectionKeyPair.new(fixture.to_json)
|
|
14
|
+
json = model.to_h
|
|
15
|
+
assert_kind_of Hash, json
|
|
16
|
+
assert_equal fixture["key"], json[:key]
|
|
17
|
+
assert_equal fixture["cert"], json[:cert]
|
|
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_create_connection_saml_options_round_trip
|
|
22
|
+
fixture = {
|
|
23
|
+
"idp_metadata_url" => "stub",
|
|
24
|
+
"acs_url" => "stub",
|
|
25
|
+
"sp_entity_id" => "stub",
|
|
26
|
+
"idp_entity_id" => "stub",
|
|
27
|
+
"idp_sso_url" => "stub",
|
|
28
|
+
"idp_signing_certs" => [],
|
|
29
|
+
"sp_signing_key_pair" => {},
|
|
30
|
+
"sp_encryption_key_pairs" => []
|
|
31
|
+
}
|
|
32
|
+
model = WorkOS::CreateConnectionSAMLOptions.new(fixture.to_json)
|
|
33
|
+
json = model.to_h
|
|
34
|
+
assert_kind_of Hash, json
|
|
35
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def test_create_connection_oidc_options_round_trip
|
|
39
|
+
fixture = {
|
|
40
|
+
"discovery_endpoint" => "stub",
|
|
41
|
+
"client_id" => "stub",
|
|
42
|
+
"client_secret" => "stub",
|
|
43
|
+
"redirect_uri" => "stub",
|
|
44
|
+
"pkce" => true,
|
|
45
|
+
"token_authentication_method" => "stub",
|
|
46
|
+
"jwt_signing_key_pair" => {},
|
|
47
|
+
"id_token_signature_algorithm" => "stub",
|
|
48
|
+
"fetch_user_info" => true
|
|
49
|
+
}
|
|
50
|
+
model = WorkOS::CreateConnectionOIDCOptions.new(fixture.to_json)
|
|
51
|
+
json = model.to_h
|
|
52
|
+
assert_kind_of Hash, json
|
|
53
|
+
assert_equal fixture["discovery_endpoint"], json[:discovery_endpoint]
|
|
54
|
+
assert_equal fixture["client_id"], json[:client_id]
|
|
55
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def test_create_connection_standard_attributes_round_trip
|
|
59
|
+
fixture = {
|
|
60
|
+
"idp_id" => "stub",
|
|
61
|
+
"email" => "stub",
|
|
62
|
+
"first_name" => "stub",
|
|
63
|
+
"last_name" => "stub",
|
|
64
|
+
"groups" => nil,
|
|
65
|
+
"name" => nil
|
|
66
|
+
}
|
|
67
|
+
model = WorkOS::CreateConnectionStandardAttributes.new(fixture.to_json)
|
|
68
|
+
json = model.to_h
|
|
69
|
+
assert_kind_of Hash, json
|
|
70
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def test_create_connection_attribute_maps_round_trip
|
|
74
|
+
fixture = {
|
|
75
|
+
"standard_attributes" => {},
|
|
76
|
+
"custom_attributes" => {}
|
|
77
|
+
}
|
|
78
|
+
model = WorkOS::CreateConnectionAttributeMaps.new(fixture.to_json)
|
|
79
|
+
json = model.to_h
|
|
80
|
+
assert_kind_of Hash, json
|
|
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_connection_round_trip
|
|
85
|
+
fixture = {
|
|
86
|
+
"organization_id" => "stub",
|
|
87
|
+
"name" => "stub",
|
|
88
|
+
"external_id" => "stub",
|
|
89
|
+
"connection_type" => "stub",
|
|
90
|
+
"attribute_maps" => {},
|
|
91
|
+
"saml_options" => {},
|
|
92
|
+
"oidc_options" => {}
|
|
93
|
+
}
|
|
94
|
+
model = WorkOS::CreateConnection.new(fixture.to_json)
|
|
95
|
+
json = model.to_h
|
|
96
|
+
assert_kind_of Hash, json
|
|
97
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
98
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
def test_patch_connection_saml_options_round_trip
|
|
102
|
+
fixture = {
|
|
103
|
+
"idp_metadata_url" => nil,
|
|
104
|
+
"acs_url" => nil,
|
|
105
|
+
"sp_entity_id" => nil,
|
|
106
|
+
"idp_entity_id" => "stub",
|
|
107
|
+
"idp_sso_url" => "stub"
|
|
108
|
+
}
|
|
109
|
+
model = WorkOS::PatchConnectionSAMLOptions.new(fixture.to_json)
|
|
110
|
+
json = model.to_h
|
|
111
|
+
assert_kind_of Hash, json
|
|
112
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def test_patch_connection_oidc_options_round_trip
|
|
116
|
+
fixture = {
|
|
117
|
+
"discovery_endpoint" => "stub",
|
|
118
|
+
"client_id" => "stub",
|
|
119
|
+
"client_secret" => "stub",
|
|
120
|
+
"redirect_uri" => nil,
|
|
121
|
+
"pkce" => true,
|
|
122
|
+
"token_authentication_method" => "stub",
|
|
123
|
+
"id_token_signature_algorithm" => "stub",
|
|
124
|
+
"fetch_user_info" => true
|
|
125
|
+
}
|
|
126
|
+
model = WorkOS::PatchConnectionOIDCOptions.new(fixture.to_json)
|
|
127
|
+
json = model.to_h
|
|
128
|
+
assert_kind_of Hash, json
|
|
129
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def test_patch_connection_standard_attributes_round_trip
|
|
133
|
+
fixture = {
|
|
134
|
+
"idp_id" => "stub",
|
|
135
|
+
"email" => "stub",
|
|
136
|
+
"first_name" => "stub",
|
|
137
|
+
"last_name" => "stub",
|
|
138
|
+
"groups" => nil,
|
|
139
|
+
"name" => nil
|
|
140
|
+
}
|
|
141
|
+
model = WorkOS::PatchConnectionStandardAttributes.new(fixture.to_json)
|
|
142
|
+
json = model.to_h
|
|
143
|
+
assert_kind_of Hash, json
|
|
144
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
145
|
+
end
|
|
146
|
+
|
|
147
|
+
def test_patch_connection_attribute_maps_round_trip
|
|
148
|
+
fixture = {
|
|
149
|
+
"standard_attributes" => {},
|
|
150
|
+
"custom_attributes" => {}
|
|
151
|
+
}
|
|
152
|
+
model = WorkOS::PatchConnectionAttributeMaps.new(fixture.to_json)
|
|
153
|
+
json = model.to_h
|
|
154
|
+
assert_kind_of Hash, json
|
|
155
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
def test_patch_connection_round_trip
|
|
159
|
+
fixture = {
|
|
160
|
+
"name" => "stub",
|
|
161
|
+
"external_id" => nil,
|
|
162
|
+
"connection_type" => "stub",
|
|
163
|
+
"attribute_maps" => {},
|
|
164
|
+
"saml_options" => {},
|
|
165
|
+
"oidc_options" => {}
|
|
166
|
+
}
|
|
167
|
+
model = WorkOS::PatchConnection.new(fixture.to_json)
|
|
168
|
+
json = model.to_h
|
|
169
|
+
assert_kind_of Hash, json
|
|
170
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
def test_create_saml_idp_signing_certificate_round_trip
|
|
174
|
+
fixture = {
|
|
175
|
+
"value" => "stub"
|
|
176
|
+
}
|
|
177
|
+
model = WorkOS::CreateSAMLIdpSigningCertificate.new(fixture.to_json)
|
|
178
|
+
json = model.to_h
|
|
179
|
+
assert_kind_of Hash, json
|
|
180
|
+
assert_equal fixture["value"], json[:value]
|
|
181
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
182
|
+
end
|
|
183
|
+
|
|
8
184
|
def test_token_query_round_trip
|
|
9
185
|
fixture = {
|
|
10
186
|
"client_id" => "stub",
|
|
11
187
|
"client_secret" => "stub",
|
|
12
188
|
"code" => "stub",
|
|
13
|
-
"grant_type" => "
|
|
189
|
+
"grant_type" => "stub",
|
|
190
|
+
"subject_token" => "stub",
|
|
191
|
+
"subject_token_type" => "urn:ietf:params:oauth:token-type:id_token",
|
|
192
|
+
"organization_id" => "stub"
|
|
14
193
|
}
|
|
15
194
|
model = WorkOS::TokenQuery.new(fixture.to_json)
|
|
16
195
|
json = model.to_h
|
|
17
196
|
assert_kind_of Hash, json
|
|
18
197
|
assert_equal fixture["client_id"], json[:client_id]
|
|
19
198
|
assert_equal fixture["client_secret"], json[:client_secret]
|
|
20
|
-
assert_equal fixture["code"], json[:code]
|
|
21
199
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
22
200
|
end
|
|
23
201
|
|
|
@@ -304,6 +482,88 @@ class SsoModelRoundTripTest < Minitest::Test
|
|
|
304
482
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
305
483
|
end
|
|
306
484
|
|
|
485
|
+
def test_saml_idp_signing_certificate_round_trip
|
|
486
|
+
fixture = {
|
|
487
|
+
"object" => "saml_idp_signing_certificate",
|
|
488
|
+
"id" => "stub",
|
|
489
|
+
"value" => "stub",
|
|
490
|
+
"not_before" => nil,
|
|
491
|
+
"not_after" => nil,
|
|
492
|
+
"created_at" => "stub"
|
|
493
|
+
}
|
|
494
|
+
model = WorkOS::SAMLIdpSigningCertificate.new(fixture.to_json)
|
|
495
|
+
json = model.to_h
|
|
496
|
+
assert_kind_of Hash, json
|
|
497
|
+
assert_equal fixture["id"], json[:id]
|
|
498
|
+
assert_equal fixture["value"], json[:value]
|
|
499
|
+
assert_nil json[:not_before]
|
|
500
|
+
assert_nil json[:not_after]
|
|
501
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
502
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
def test_saml_idp_signing_certificate_list_round_trip
|
|
506
|
+
fixture = {
|
|
507
|
+
"object" => "list",
|
|
508
|
+
"data" => []
|
|
509
|
+
}
|
|
510
|
+
model = WorkOS::SAMLIdpSigningCertificateList.new(fixture.to_json)
|
|
511
|
+
json = model.to_h
|
|
512
|
+
assert_kind_of Hash, json
|
|
513
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
def test_saml_sp_encryption_certificate_round_trip
|
|
517
|
+
fixture = {
|
|
518
|
+
"object" => "saml_sp_encryption_certificate",
|
|
519
|
+
"id" => "stub",
|
|
520
|
+
"value" => "stub",
|
|
521
|
+
"not_before" => nil,
|
|
522
|
+
"not_after" => nil,
|
|
523
|
+
"created_at" => "stub"
|
|
524
|
+
}
|
|
525
|
+
model = WorkOS::SAMLSpEncryptionCertificate.new(fixture.to_json)
|
|
526
|
+
json = model.to_h
|
|
527
|
+
assert_kind_of Hash, json
|
|
528
|
+
assert_equal fixture["id"], json[:id]
|
|
529
|
+
assert_equal fixture["value"], json[:value]
|
|
530
|
+
assert_nil json[:not_before]
|
|
531
|
+
assert_nil json[:not_after]
|
|
532
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
533
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
def test_saml_sp_encryption_certificate_list_round_trip
|
|
537
|
+
fixture = {
|
|
538
|
+
"object" => "list",
|
|
539
|
+
"data" => []
|
|
540
|
+
}
|
|
541
|
+
model = WorkOS::SAMLSpEncryptionCertificateList.new(fixture.to_json)
|
|
542
|
+
json = model.to_h
|
|
543
|
+
assert_kind_of Hash, json
|
|
544
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
545
|
+
end
|
|
546
|
+
|
|
547
|
+
def test_saml_sp_signing_certificate_round_trip
|
|
548
|
+
fixture = {
|
|
549
|
+
"object" => "saml_sp_signing_certificate",
|
|
550
|
+
"id" => "stub",
|
|
551
|
+
"value" => "stub",
|
|
552
|
+
"not_before" => nil,
|
|
553
|
+
"not_after" => nil,
|
|
554
|
+
"created_at" => "stub"
|
|
555
|
+
}
|
|
556
|
+
model = WorkOS::SAMLSpSigningCertificate.new(fixture.to_json)
|
|
557
|
+
json = model.to_h
|
|
558
|
+
assert_kind_of Hash, json
|
|
559
|
+
assert_equal fixture["id"], json[:id]
|
|
560
|
+
assert_equal fixture["value"], json[:value]
|
|
561
|
+
assert_nil json[:not_before]
|
|
562
|
+
assert_nil json[:not_after]
|
|
563
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
564
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
565
|
+
end
|
|
566
|
+
|
|
307
567
|
def test_sso_authorize_url_response_round_trip
|
|
308
568
|
fixture = {
|
|
309
569
|
"url" => "stub"
|
|
@@ -203,6 +203,27 @@ class UserManagementTest < Minitest::Test
|
|
|
203
203
|
assert_nil result
|
|
204
204
|
end
|
|
205
205
|
|
|
206
|
+
def test_list_authkit_oauth_resources_returns_expected_result
|
|
207
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/authkit_oauth_resources(\?|\z)})
|
|
208
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
209
|
+
result = @client.user_management.list_authkit_oauth_resources
|
|
210
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
def test_create_authkit_oauth_resource_returns_expected_result
|
|
214
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/authkit_oauth_resources(\?|\z)})
|
|
215
|
+
.to_return(body: "{}", status: 200)
|
|
216
|
+
result = @client.user_management.create_authkit_oauth_resource(uri: "stub")
|
|
217
|
+
refute_nil result
|
|
218
|
+
end
|
|
219
|
+
|
|
220
|
+
def test_delete_authkit_oauth_resource_returns_expected_result
|
|
221
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/authkit_oauth_resources/stub(\?|\z)})
|
|
222
|
+
.to_return(body: "{}", status: 200)
|
|
223
|
+
result = @client.user_management.delete_authkit_oauth_resource(id: "stub")
|
|
224
|
+
assert_nil result
|
|
225
|
+
end
|
|
226
|
+
|
|
206
227
|
def test_list_cors_origins_returns_expected_result
|
|
207
228
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)})
|
|
208
229
|
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
@@ -459,6 +480,55 @@ class UserManagementTest < Minitest::Test
|
|
|
459
480
|
assert_nil result
|
|
460
481
|
end
|
|
461
482
|
|
|
483
|
+
def test_delete_waitlist_entry_returns_expected_result
|
|
484
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub(\?|\z)})
|
|
485
|
+
.to_return(body: "{}", status: 200)
|
|
486
|
+
result = @client.user_management.delete_waitlist_entry(id: "stub")
|
|
487
|
+
assert_nil result
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
def test_create_waitlist_entry_approve_returns_expected_result
|
|
491
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/approve(\?|\z)})
|
|
492
|
+
.to_return(body: "{}", status: 200)
|
|
493
|
+
result = @client.user_management.create_waitlist_entry_approve(id: "stub")
|
|
494
|
+
refute_nil result
|
|
495
|
+
end
|
|
496
|
+
|
|
497
|
+
def test_create_waitlist_entry_deny_returns_expected_result
|
|
498
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/deny(\?|\z)})
|
|
499
|
+
.to_return(body: "{}", status: 200)
|
|
500
|
+
result = @client.user_management.create_waitlist_entry_deny(id: "stub")
|
|
501
|
+
refute_nil result
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
def test_list_waitlists_returns_expected_result
|
|
505
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/waitlists(\?|\z)})
|
|
506
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
507
|
+
result = @client.user_management.list_waitlists
|
|
508
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
509
|
+
end
|
|
510
|
+
|
|
511
|
+
def test_get_waitlist_returns_expected_result
|
|
512
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub(\?|\z)})
|
|
513
|
+
.to_return(body: "{}", status: 200)
|
|
514
|
+
result = @client.user_management.get_waitlist(id: "stub")
|
|
515
|
+
refute_nil result
|
|
516
|
+
end
|
|
517
|
+
|
|
518
|
+
def test_list_waitlist_entries_returns_expected_result
|
|
519
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)})
|
|
520
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
521
|
+
result = @client.user_management.list_waitlist_entries(id: "stub")
|
|
522
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
523
|
+
end
|
|
524
|
+
|
|
525
|
+
def test_create_waitlist_entry_returns_expected_result
|
|
526
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)})
|
|
527
|
+
.to_return(body: "{}", status: 200)
|
|
528
|
+
result = @client.user_management.create_waitlist_entry(id: "stub", email: "stub")
|
|
529
|
+
refute_nil result
|
|
530
|
+
end
|
|
531
|
+
|
|
462
532
|
def test_list_user_api_keys_returns_expected_result
|
|
463
533
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)})
|
|
464
534
|
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
@@ -481,6 +551,9 @@ class UserManagementTest < Minitest::Test
|
|
|
481
551
|
{name: :create_radar_challenge, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/radar_challenges(\?|\z)}, args: {user_id: "stub", pending_authentication_token: "stub", phone_number: "stub"}},
|
|
482
552
|
{name: :get_radar_challenge, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/radar_challenges/stub(\?|\z)}, args: {id: "stub"}},
|
|
483
553
|
{name: :revoke_session, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/sessions/revoke(\?|\z)}, args: {session_id: "stub"}},
|
|
554
|
+
{name: :list_authkit_oauth_resources, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/authkit_oauth_resources(\?|\z)}},
|
|
555
|
+
{name: :create_authkit_oauth_resource, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/authkit_oauth_resources(\?|\z)}, args: {uri: "stub"}},
|
|
556
|
+
{name: :delete_authkit_oauth_resource, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/authkit_oauth_resources/stub(\?|\z)}, args: {id: "stub"}},
|
|
484
557
|
{name: :list_cors_origins, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)}},
|
|
485
558
|
{name: :create_cors_origin, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/cors_origins(\?|\z)}, args: {origin: "stub"}},
|
|
486
559
|
{name: :get_email_verification, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/email_verification/stub(\?|\z)}, args: {id: "stub"}},
|
|
@@ -515,6 +588,13 @@ class UserManagementTest < Minitest::Test
|
|
|
515
588
|
{name: :delete_redirect_uris, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/redirect_uris/stub(\?|\z)}, args: {id: "stub"}},
|
|
516
589
|
{name: :list_user_authorized_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications(\?|\z)}, args: {user_id: "stub"}},
|
|
517
590
|
{name: :delete_user_authorized_application, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/authorized_applications/stub(\?|\z)}, args: {application_id: "stub", user_id: "stub"}},
|
|
591
|
+
{name: :delete_waitlist_entry, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub(\?|\z)}, args: {id: "stub"}},
|
|
592
|
+
{name: :create_waitlist_entry_approve, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/approve(\?|\z)}, args: {id: "stub"}},
|
|
593
|
+
{name: :create_waitlist_entry_deny, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/deny(\?|\z)}, args: {id: "stub"}},
|
|
594
|
+
{name: :list_waitlists, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists(\?|\z)}},
|
|
595
|
+
{name: :get_waitlist, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub(\?|\z)}, args: {id: "stub"}},
|
|
596
|
+
{name: :list_waitlist_entries, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)}, args: {id: "stub"}},
|
|
597
|
+
{name: :create_waitlist_entry, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)}, args: {id: "stub", email: "stub"}},
|
|
518
598
|
{name: :list_user_api_keys, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}, args: {user_id: "stub"}},
|
|
519
599
|
{name: :create_user_api_key, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)}, args: {user_id: "stub", name: "stub", organization_id: "stub"}}
|
|
520
600
|
].each do |spec|
|