workos 10.2.1 → 10.3.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/.last-synced-sha +1 -1
- data/.oagen-manifest.json +311 -0
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +154 -0
- data/Gemfile.lock +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 +395 -0
- data/lib/workos/api_keys/validate_api_key.rb +1 -12
- data/lib/workos/audit_logs.rb +23 -5
- data/lib/workos/authorization.rb +3 -3
- data/lib/workos/client.rb +4 -0
- data/lib/workos/inflections.rb +15 -0
- 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/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/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/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/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_webhook_endpoint_events.rb +8 -1
- 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/resource_export_completed_data_resource_type.rb +16 -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/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 +176 -0
- data/lib/workos/version.rb +1 -1
- data/lib/workos.rb +1 -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 +133 -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/client.rbi +3 -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_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/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/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 +64 -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_platform_teams.rb +41 -0
- data/test/workos/test_platform_teams_model_round_trip.rb +41 -0
- data/test/workos/test_shared_model_round_trip.rb +449 -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 +56 -0
- data/test/workos/test_user_management_model_round_trip.rb +78 -2
- metadata +160 -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"
|
|
@@ -459,6 +459,55 @@ class UserManagementTest < Minitest::Test
|
|
|
459
459
|
assert_nil result
|
|
460
460
|
end
|
|
461
461
|
|
|
462
|
+
def test_delete_waitlist_entry_returns_expected_result
|
|
463
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub(\?|\z)})
|
|
464
|
+
.to_return(body: "{}", status: 200)
|
|
465
|
+
result = @client.user_management.delete_waitlist_entry(id: "stub")
|
|
466
|
+
assert_nil result
|
|
467
|
+
end
|
|
468
|
+
|
|
469
|
+
def test_create_waitlist_entry_approve_returns_expected_result
|
|
470
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/approve(\?|\z)})
|
|
471
|
+
.to_return(body: "{}", status: 200)
|
|
472
|
+
result = @client.user_management.create_waitlist_entry_approve(id: "stub")
|
|
473
|
+
refute_nil result
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
def test_create_waitlist_entry_deny_returns_expected_result
|
|
477
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/deny(\?|\z)})
|
|
478
|
+
.to_return(body: "{}", status: 200)
|
|
479
|
+
result = @client.user_management.create_waitlist_entry_deny(id: "stub")
|
|
480
|
+
refute_nil result
|
|
481
|
+
end
|
|
482
|
+
|
|
483
|
+
def test_list_waitlists_returns_expected_result
|
|
484
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/waitlists(\?|\z)})
|
|
485
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
486
|
+
result = @client.user_management.list_waitlists
|
|
487
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
488
|
+
end
|
|
489
|
+
|
|
490
|
+
def test_get_waitlist_returns_expected_result
|
|
491
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub(\?|\z)})
|
|
492
|
+
.to_return(body: "{}", status: 200)
|
|
493
|
+
result = @client.user_management.get_waitlist(id: "stub")
|
|
494
|
+
refute_nil result
|
|
495
|
+
end
|
|
496
|
+
|
|
497
|
+
def test_list_waitlist_entries_returns_expected_result
|
|
498
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)})
|
|
499
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
500
|
+
result = @client.user_management.list_waitlist_entries(id: "stub")
|
|
501
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
502
|
+
end
|
|
503
|
+
|
|
504
|
+
def test_create_waitlist_entry_returns_expected_result
|
|
505
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)})
|
|
506
|
+
.to_return(body: "{}", status: 200)
|
|
507
|
+
result = @client.user_management.create_waitlist_entry(id: "stub", email: "stub")
|
|
508
|
+
refute_nil result
|
|
509
|
+
end
|
|
510
|
+
|
|
462
511
|
def test_list_user_api_keys_returns_expected_result
|
|
463
512
|
stub_request(:get, %r{\Ahttps://api\.workos\.com/user_management/users/stub/api_keys(\?|\z)})
|
|
464
513
|
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
@@ -515,6 +564,13 @@ class UserManagementTest < Minitest::Test
|
|
|
515
564
|
{name: :delete_redirect_uris, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/redirect_uris/stub(\?|\z)}, args: {id: "stub"}},
|
|
516
565
|
{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
566
|
{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"}},
|
|
567
|
+
{name: :delete_waitlist_entry, verb: :delete, url: %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub(\?|\z)}, args: {id: "stub"}},
|
|
568
|
+
{name: :create_waitlist_entry_approve, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/approve(\?|\z)}, args: {id: "stub"}},
|
|
569
|
+
{name: :create_waitlist_entry_deny, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/waitlist_entries/stub/deny(\?|\z)}, args: {id: "stub"}},
|
|
570
|
+
{name: :list_waitlists, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists(\?|\z)}},
|
|
571
|
+
{name: :get_waitlist, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub(\?|\z)}, args: {id: "stub"}},
|
|
572
|
+
{name: :list_waitlist_entries, verb: :get, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)}, args: {id: "stub"}},
|
|
573
|
+
{name: :create_waitlist_entry, verb: :post, url: %r{\Ahttps://api\.workos\.com/user_management/waitlists/stub/entries(\?|\z)}, args: {id: "stub", email: "stub"}},
|
|
518
574
|
{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
575
|
{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
576
|
].each do |spec|
|
|
@@ -225,6 +225,19 @@ class UserManagementModelRoundTripTest < Minitest::Test
|
|
|
225
225
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
226
226
|
end
|
|
227
227
|
|
|
228
|
+
def test_create_waitlist_entry_round_trip
|
|
229
|
+
fixture = {
|
|
230
|
+
"email" => "stub",
|
|
231
|
+
"additional_fields" => {},
|
|
232
|
+
"send_confirmation_email" => true
|
|
233
|
+
}
|
|
234
|
+
model = WorkOS::CreateWaitlistEntry.new(fixture.to_json)
|
|
235
|
+
json = model.to_h
|
|
236
|
+
assert_kind_of Hash, json
|
|
237
|
+
assert_equal fixture["email"], json[:email]
|
|
238
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
239
|
+
end
|
|
240
|
+
|
|
228
241
|
def test_user_round_trip
|
|
229
242
|
fixture = {
|
|
230
243
|
"object" => "user",
|
|
@@ -683,7 +696,8 @@ class UserManagementModelRoundTripTest < Minitest::Test
|
|
|
683
696
|
"user_agent" => nil,
|
|
684
697
|
"user_id" => nil,
|
|
685
698
|
"email" => nil,
|
|
686
|
-
"error" => {}
|
|
699
|
+
"error" => {},
|
|
700
|
+
"provider" => "stub"
|
|
687
701
|
}
|
|
688
702
|
model = WorkOS::AuthenticationOAuthFailedData.new(fixture.to_json)
|
|
689
703
|
json = model.to_h
|
|
@@ -732,7 +746,8 @@ class UserManagementModelRoundTripTest < Minitest::Test
|
|
|
732
746
|
"ip_address" => nil,
|
|
733
747
|
"user_agent" => nil,
|
|
734
748
|
"user_id" => nil,
|
|
735
|
-
"email" => "stub"
|
|
749
|
+
"email" => "stub",
|
|
750
|
+
"provider" => "stub"
|
|
736
751
|
}
|
|
737
752
|
model = WorkOS::AuthenticationOAuthSucceededData.new(fixture.to_json)
|
|
738
753
|
json = model.to_h
|
|
@@ -2058,6 +2073,45 @@ class UserManagementModelRoundTripTest < Minitest::Test
|
|
|
2058
2073
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
2059
2074
|
end
|
|
2060
2075
|
|
|
2076
|
+
def test_waitlist_round_trip
|
|
2077
|
+
fixture = {
|
|
2078
|
+
"object" => "waitlist",
|
|
2079
|
+
"id" => "stub",
|
|
2080
|
+
"created_at" => "stub",
|
|
2081
|
+
"updated_at" => "stub"
|
|
2082
|
+
}
|
|
2083
|
+
model = WorkOS::Waitlist.new(fixture.to_json)
|
|
2084
|
+
json = model.to_h
|
|
2085
|
+
assert_kind_of Hash, json
|
|
2086
|
+
assert_equal fixture["id"], json[:id]
|
|
2087
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
2088
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
2089
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
2090
|
+
end
|
|
2091
|
+
|
|
2092
|
+
def test_waitlist_entry_round_trip
|
|
2093
|
+
fixture = {
|
|
2094
|
+
"id" => "stub",
|
|
2095
|
+
"email" => "stub",
|
|
2096
|
+
"state" => "stub",
|
|
2097
|
+
"approved_at" => nil,
|
|
2098
|
+
"additional_fields" => {},
|
|
2099
|
+
"waitlist_id" => nil,
|
|
2100
|
+
"created_at" => "stub",
|
|
2101
|
+
"updated_at" => "stub",
|
|
2102
|
+
"object" => "waitlist_entry"
|
|
2103
|
+
}
|
|
2104
|
+
model = WorkOS::WaitlistEntry.new(fixture.to_json)
|
|
2105
|
+
json = model.to_h
|
|
2106
|
+
assert_kind_of Hash, json
|
|
2107
|
+
assert_equal fixture["id"], json[:id]
|
|
2108
|
+
assert_equal fixture["email"], json[:email]
|
|
2109
|
+
assert_nil json[:approved_at]
|
|
2110
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
2111
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
2112
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
2113
|
+
end
|
|
2114
|
+
|
|
2061
2115
|
def test_jwks_response_round_trip
|
|
2062
2116
|
fixture = {
|
|
2063
2117
|
"keys" => []
|
|
@@ -2295,6 +2349,28 @@ class UserManagementModelRoundTripTest < Minitest::Test
|
|
|
2295
2349
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
2296
2350
|
end
|
|
2297
2351
|
|
|
2352
|
+
def test_email_completion_session_authenticate_request_round_trip
|
|
2353
|
+
fixture = {
|
|
2354
|
+
"client_id" => "stub",
|
|
2355
|
+
"client_secret" => "stub",
|
|
2356
|
+
"grant_type" => "urn:workos:oauth:grant-type:email-completion",
|
|
2357
|
+
"email_completion_token" => "stub",
|
|
2358
|
+
"email" => "stub",
|
|
2359
|
+
"ip_address" => "stub",
|
|
2360
|
+
"device_id" => "stub",
|
|
2361
|
+
"user_agent" => "stub",
|
|
2362
|
+
"signals_id" => "stub"
|
|
2363
|
+
}
|
|
2364
|
+
model = WorkOS::EmailCompletionSessionAuthenticateRequest.new(fixture.to_json)
|
|
2365
|
+
json = model.to_h
|
|
2366
|
+
assert_kind_of Hash, json
|
|
2367
|
+
assert_equal fixture["client_id"], json[:client_id]
|
|
2368
|
+
assert_equal fixture["client_secret"], json[:client_secret]
|
|
2369
|
+
assert_equal fixture["email_completion_token"], json[:email_completion_token]
|
|
2370
|
+
assert_equal fixture["email"], json[:email]
|
|
2371
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
2372
|
+
end
|
|
2373
|
+
|
|
2298
2374
|
def test_organization_selection_session_authenticate_request_round_trip
|
|
2299
2375
|
fixture = {
|
|
2300
2376
|
"client_id" => "stub",
|