workos 10.2.0 → 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/.github/workflows/block-generated-edits.yml +1 -1
- data/.github/workflows/ci.yml +2 -2
- data/.github/workflows/docs.yml +2 -2
- 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 +311 -0
- data/.release-please-manifest.json +1 -1
- data/CHANGELOG.md +161 -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/base_client.rb +14 -1
- 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_base_client.rb +155 -0
- 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
|
@@ -176,14 +176,15 @@ class SharedModelRoundTripTest < Minitest::Test
|
|
|
176
176
|
|
|
177
177
|
def test_waitlist_user_round_trip
|
|
178
178
|
fixture = {
|
|
179
|
-
"object" => "waitlist_user",
|
|
180
179
|
"id" => "stub",
|
|
181
180
|
"email" => "stub",
|
|
182
181
|
"state" => "stub",
|
|
183
182
|
"approved_at" => nil,
|
|
183
|
+
"additional_fields" => {},
|
|
184
184
|
"waitlist_id" => nil,
|
|
185
185
|
"created_at" => "stub",
|
|
186
|
-
"updated_at" => "stub"
|
|
186
|
+
"updated_at" => "stub",
|
|
187
|
+
"object" => "waitlist_user"
|
|
187
188
|
}
|
|
188
189
|
model = WorkOS::WaitlistUser.new(fixture.to_json)
|
|
189
190
|
json = model.to_h
|
|
@@ -214,6 +215,336 @@ class SharedModelRoundTripTest < Minitest::Test
|
|
|
214
215
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
215
216
|
end
|
|
216
217
|
|
|
218
|
+
def test_agent_blueprint_created_round_trip
|
|
219
|
+
fixture = {
|
|
220
|
+
"object" => "event",
|
|
221
|
+
"id" => "stub",
|
|
222
|
+
"event" => "agent.blueprint.created",
|
|
223
|
+
"data" => {},
|
|
224
|
+
"created_at" => "stub",
|
|
225
|
+
"context" => {}
|
|
226
|
+
}
|
|
227
|
+
model = WorkOS::AgentBlueprintCreated.new(fixture.to_json)
|
|
228
|
+
json = model.to_h
|
|
229
|
+
assert_kind_of Hash, json
|
|
230
|
+
assert_equal fixture["id"], json[:id]
|
|
231
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
232
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
def test_agent_blueprint_created_data_round_trip
|
|
236
|
+
fixture = {
|
|
237
|
+
"object" => "agent_blueprint",
|
|
238
|
+
"id" => "stub",
|
|
239
|
+
"name" => "stub",
|
|
240
|
+
"description" => nil,
|
|
241
|
+
"permissions" => [],
|
|
242
|
+
"invocable_by" => {},
|
|
243
|
+
"session_settings" => {},
|
|
244
|
+
"created_at" => "stub",
|
|
245
|
+
"updated_at" => "stub"
|
|
246
|
+
}
|
|
247
|
+
model = WorkOS::AgentBlueprintCreatedData.new(fixture.to_json)
|
|
248
|
+
json = model.to_h
|
|
249
|
+
assert_kind_of Hash, json
|
|
250
|
+
assert_equal fixture["id"], json[:id]
|
|
251
|
+
assert_equal fixture["name"], json[:name]
|
|
252
|
+
assert_nil json[:description]
|
|
253
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
254
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
255
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
256
|
+
end
|
|
257
|
+
|
|
258
|
+
def test_agent_blueprint_created_data_invocable_by_round_trip
|
|
259
|
+
fixture = {
|
|
260
|
+
"role_slugs" => [],
|
|
261
|
+
"organization_ids" => []
|
|
262
|
+
}
|
|
263
|
+
model = WorkOS::AgentBlueprintCreatedDataInvocableBy.new(fixture.to_json)
|
|
264
|
+
json = model.to_h
|
|
265
|
+
assert_kind_of Hash, json
|
|
266
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
267
|
+
end
|
|
268
|
+
|
|
269
|
+
def test_agent_blueprint_created_data_session_setting_round_trip
|
|
270
|
+
fixture = {
|
|
271
|
+
"max_age_seconds" => 1.0,
|
|
272
|
+
"access_token_ttl_seconds" => 1.0,
|
|
273
|
+
"refresh_token_ttl_seconds" => 1.0
|
|
274
|
+
}
|
|
275
|
+
model = WorkOS::AgentBlueprintCreatedDataSessionSetting.new(fixture.to_json)
|
|
276
|
+
json = model.to_h
|
|
277
|
+
assert_kind_of Hash, json
|
|
278
|
+
assert_equal fixture["max_age_seconds"], json[:max_age_seconds]
|
|
279
|
+
assert_equal fixture["access_token_ttl_seconds"], json[:access_token_ttl_seconds]
|
|
280
|
+
assert_equal fixture["refresh_token_ttl_seconds"], json[:refresh_token_ttl_seconds]
|
|
281
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
282
|
+
end
|
|
283
|
+
|
|
284
|
+
def test_agent_blueprint_deleted_round_trip
|
|
285
|
+
fixture = {
|
|
286
|
+
"object" => "event",
|
|
287
|
+
"id" => "stub",
|
|
288
|
+
"event" => "agent.blueprint.deleted",
|
|
289
|
+
"data" => {},
|
|
290
|
+
"created_at" => "stub",
|
|
291
|
+
"context" => {}
|
|
292
|
+
}
|
|
293
|
+
model = WorkOS::AgentBlueprintDeleted.new(fixture.to_json)
|
|
294
|
+
json = model.to_h
|
|
295
|
+
assert_kind_of Hash, json
|
|
296
|
+
assert_equal fixture["id"], json[:id]
|
|
297
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
298
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
299
|
+
end
|
|
300
|
+
|
|
301
|
+
def test_agent_blueprint_deleted_data_round_trip
|
|
302
|
+
fixture = {
|
|
303
|
+
"object" => "agent_blueprint",
|
|
304
|
+
"id" => "stub",
|
|
305
|
+
"name" => "stub",
|
|
306
|
+
"created_at" => "stub",
|
|
307
|
+
"updated_at" => "stub"
|
|
308
|
+
}
|
|
309
|
+
model = WorkOS::AgentBlueprintDeletedData.new(fixture.to_json)
|
|
310
|
+
json = model.to_h
|
|
311
|
+
assert_kind_of Hash, json
|
|
312
|
+
assert_equal fixture["id"], json[:id]
|
|
313
|
+
assert_equal fixture["name"], json[:name]
|
|
314
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
315
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
316
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
317
|
+
end
|
|
318
|
+
|
|
319
|
+
def test_agent_blueprint_updated_round_trip
|
|
320
|
+
fixture = {
|
|
321
|
+
"object" => "event",
|
|
322
|
+
"id" => "stub",
|
|
323
|
+
"event" => "agent.blueprint.updated",
|
|
324
|
+
"data" => {},
|
|
325
|
+
"created_at" => "stub",
|
|
326
|
+
"context" => {}
|
|
327
|
+
}
|
|
328
|
+
model = WorkOS::AgentBlueprintUpdated.new(fixture.to_json)
|
|
329
|
+
json = model.to_h
|
|
330
|
+
assert_kind_of Hash, json
|
|
331
|
+
assert_equal fixture["id"], json[:id]
|
|
332
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
333
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
334
|
+
end
|
|
335
|
+
|
|
336
|
+
def test_agent_blueprint_updated_data_round_trip
|
|
337
|
+
fixture = {
|
|
338
|
+
"object" => "agent_blueprint",
|
|
339
|
+
"id" => "stub",
|
|
340
|
+
"name" => "stub",
|
|
341
|
+
"description" => nil,
|
|
342
|
+
"permissions" => [],
|
|
343
|
+
"invocable_by" => {},
|
|
344
|
+
"session_settings" => {},
|
|
345
|
+
"created_at" => "stub",
|
|
346
|
+
"updated_at" => "stub"
|
|
347
|
+
}
|
|
348
|
+
model = WorkOS::AgentBlueprintUpdatedData.new(fixture.to_json)
|
|
349
|
+
json = model.to_h
|
|
350
|
+
assert_kind_of Hash, json
|
|
351
|
+
assert_equal fixture["id"], json[:id]
|
|
352
|
+
assert_equal fixture["name"], json[:name]
|
|
353
|
+
assert_nil json[:description]
|
|
354
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
355
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
356
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
357
|
+
end
|
|
358
|
+
|
|
359
|
+
def test_agent_blueprint_updated_data_invocable_by_round_trip
|
|
360
|
+
fixture = {
|
|
361
|
+
"role_slugs" => [],
|
|
362
|
+
"organization_ids" => []
|
|
363
|
+
}
|
|
364
|
+
model = WorkOS::AgentBlueprintUpdatedDataInvocableBy.new(fixture.to_json)
|
|
365
|
+
json = model.to_h
|
|
366
|
+
assert_kind_of Hash, json
|
|
367
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
368
|
+
end
|
|
369
|
+
|
|
370
|
+
def test_agent_blueprint_updated_data_session_setting_round_trip
|
|
371
|
+
fixture = {
|
|
372
|
+
"max_age_seconds" => 1.0,
|
|
373
|
+
"access_token_ttl_seconds" => 1.0,
|
|
374
|
+
"refresh_token_ttl_seconds" => 1.0
|
|
375
|
+
}
|
|
376
|
+
model = WorkOS::AgentBlueprintUpdatedDataSessionSetting.new(fixture.to_json)
|
|
377
|
+
json = model.to_h
|
|
378
|
+
assert_kind_of Hash, json
|
|
379
|
+
assert_equal fixture["max_age_seconds"], json[:max_age_seconds]
|
|
380
|
+
assert_equal fixture["access_token_ttl_seconds"], json[:access_token_ttl_seconds]
|
|
381
|
+
assert_equal fixture["refresh_token_ttl_seconds"], json[:refresh_token_ttl_seconds]
|
|
382
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
383
|
+
end
|
|
384
|
+
|
|
385
|
+
def test_agent_instance_created_round_trip
|
|
386
|
+
fixture = {
|
|
387
|
+
"object" => "event",
|
|
388
|
+
"id" => "stub",
|
|
389
|
+
"event" => "agent.instance.created",
|
|
390
|
+
"data" => {},
|
|
391
|
+
"created_at" => "stub",
|
|
392
|
+
"context" => {}
|
|
393
|
+
}
|
|
394
|
+
model = WorkOS::AgentInstanceCreated.new(fixture.to_json)
|
|
395
|
+
json = model.to_h
|
|
396
|
+
assert_kind_of Hash, json
|
|
397
|
+
assert_equal fixture["id"], json[:id]
|
|
398
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
399
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
def test_agent_instance_created_data_round_trip
|
|
403
|
+
fixture = {
|
|
404
|
+
"object" => "agent_instance",
|
|
405
|
+
"id" => "stub",
|
|
406
|
+
"agent_blueprint_id" => "stub",
|
|
407
|
+
"organization_id" => "stub",
|
|
408
|
+
"organization_membership_id" => nil,
|
|
409
|
+
"type" => "stub",
|
|
410
|
+
"created_at" => "stub",
|
|
411
|
+
"updated_at" => "stub"
|
|
412
|
+
}
|
|
413
|
+
model = WorkOS::AgentInstanceCreatedData.new(fixture.to_json)
|
|
414
|
+
json = model.to_h
|
|
415
|
+
assert_kind_of Hash, json
|
|
416
|
+
assert_equal fixture["id"], json[:id]
|
|
417
|
+
assert_equal fixture["agent_blueprint_id"], json[:agent_blueprint_id]
|
|
418
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
419
|
+
assert_nil json[:organization_membership_id]
|
|
420
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
421
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
422
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
423
|
+
end
|
|
424
|
+
|
|
425
|
+
def test_agent_instance_deleted_round_trip
|
|
426
|
+
fixture = {
|
|
427
|
+
"object" => "event",
|
|
428
|
+
"id" => "stub",
|
|
429
|
+
"event" => "agent.instance.deleted",
|
|
430
|
+
"data" => {},
|
|
431
|
+
"created_at" => "stub",
|
|
432
|
+
"context" => {}
|
|
433
|
+
}
|
|
434
|
+
model = WorkOS::AgentInstanceDeleted.new(fixture.to_json)
|
|
435
|
+
json = model.to_h
|
|
436
|
+
assert_kind_of Hash, json
|
|
437
|
+
assert_equal fixture["id"], json[:id]
|
|
438
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
439
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
440
|
+
end
|
|
441
|
+
|
|
442
|
+
def test_agent_instance_deleted_data_round_trip
|
|
443
|
+
fixture = {
|
|
444
|
+
"object" => "agent_instance",
|
|
445
|
+
"id" => "stub",
|
|
446
|
+
"agent_blueprint_id" => "stub",
|
|
447
|
+
"organization_id" => "stub",
|
|
448
|
+
"organization_membership_id" => nil,
|
|
449
|
+
"type" => "stub",
|
|
450
|
+
"created_at" => "stub",
|
|
451
|
+
"updated_at" => "stub"
|
|
452
|
+
}
|
|
453
|
+
model = WorkOS::AgentInstanceDeletedData.new(fixture.to_json)
|
|
454
|
+
json = model.to_h
|
|
455
|
+
assert_kind_of Hash, json
|
|
456
|
+
assert_equal fixture["id"], json[:id]
|
|
457
|
+
assert_equal fixture["agent_blueprint_id"], json[:agent_blueprint_id]
|
|
458
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
459
|
+
assert_nil json[:organization_membership_id]
|
|
460
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
461
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
462
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
def test_agent_instance_session_created_round_trip
|
|
466
|
+
fixture = {
|
|
467
|
+
"object" => "event",
|
|
468
|
+
"id" => "stub",
|
|
469
|
+
"event" => "agent.instance.session.created",
|
|
470
|
+
"data" => {},
|
|
471
|
+
"created_at" => "stub",
|
|
472
|
+
"context" => {}
|
|
473
|
+
}
|
|
474
|
+
model = WorkOS::AgentInstanceSessionCreated.new(fixture.to_json)
|
|
475
|
+
json = model.to_h
|
|
476
|
+
assert_kind_of Hash, json
|
|
477
|
+
assert_equal fixture["id"], json[:id]
|
|
478
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
479
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
def test_agent_instance_session_created_data_round_trip
|
|
483
|
+
fixture = {
|
|
484
|
+
"object" => "agent_instance_session",
|
|
485
|
+
"id" => "stub",
|
|
486
|
+
"agent_instance_id" => "stub",
|
|
487
|
+
"organization_id" => "stub",
|
|
488
|
+
"expires_at" => "stub",
|
|
489
|
+
"revoked_at" => nil,
|
|
490
|
+
"created_at" => "stub",
|
|
491
|
+
"updated_at" => "stub",
|
|
492
|
+
"permission_slugs" => []
|
|
493
|
+
}
|
|
494
|
+
model = WorkOS::AgentInstanceSessionCreatedData.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["agent_instance_id"], json[:agent_instance_id]
|
|
499
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
500
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
501
|
+
assert_nil json[:revoked_at]
|
|
502
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
503
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
504
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
505
|
+
end
|
|
506
|
+
|
|
507
|
+
def test_agent_instance_session_revoked_round_trip
|
|
508
|
+
fixture = {
|
|
509
|
+
"object" => "event",
|
|
510
|
+
"id" => "stub",
|
|
511
|
+
"event" => "agent.instance.session.revoked",
|
|
512
|
+
"data" => {},
|
|
513
|
+
"created_at" => "stub",
|
|
514
|
+
"context" => {}
|
|
515
|
+
}
|
|
516
|
+
model = WorkOS::AgentInstanceSessionRevoked.new(fixture.to_json)
|
|
517
|
+
json = model.to_h
|
|
518
|
+
assert_kind_of Hash, json
|
|
519
|
+
assert_equal fixture["id"], json[:id]
|
|
520
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
521
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
522
|
+
end
|
|
523
|
+
|
|
524
|
+
def test_agent_instance_session_revoked_data_round_trip
|
|
525
|
+
fixture = {
|
|
526
|
+
"object" => "agent_instance_session",
|
|
527
|
+
"id" => "stub",
|
|
528
|
+
"agent_instance_id" => "stub",
|
|
529
|
+
"organization_id" => "stub",
|
|
530
|
+
"expires_at" => "stub",
|
|
531
|
+
"revoked_at" => nil,
|
|
532
|
+
"created_at" => "stub",
|
|
533
|
+
"updated_at" => "stub"
|
|
534
|
+
}
|
|
535
|
+
model = WorkOS::AgentInstanceSessionRevokedData.new(fixture.to_json)
|
|
536
|
+
json = model.to_h
|
|
537
|
+
assert_kind_of Hash, json
|
|
538
|
+
assert_equal fixture["id"], json[:id]
|
|
539
|
+
assert_equal fixture["agent_instance_id"], json[:agent_instance_id]
|
|
540
|
+
assert_equal fixture["organization_id"], json[:organization_id]
|
|
541
|
+
assert_equal fixture["expires_at"], json[:expires_at]
|
|
542
|
+
assert_nil json[:revoked_at]
|
|
543
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
544
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
545
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
546
|
+
end
|
|
547
|
+
|
|
217
548
|
def test_agent_registration_claim_attempt_created_round_trip
|
|
218
549
|
fixture = {
|
|
219
550
|
"object" => "event",
|
|
@@ -804,6 +1135,122 @@ class SharedModelRoundTripTest < Minitest::Test
|
|
|
804
1135
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
805
1136
|
end
|
|
806
1137
|
|
|
1138
|
+
def test_resource_export_completed_round_trip
|
|
1139
|
+
fixture = {
|
|
1140
|
+
"object" => "event",
|
|
1141
|
+
"id" => "stub",
|
|
1142
|
+
"event" => "resource_export.completed",
|
|
1143
|
+
"data" => {},
|
|
1144
|
+
"created_at" => "stub",
|
|
1145
|
+
"context" => {}
|
|
1146
|
+
}
|
|
1147
|
+
model = WorkOS::ResourceExportCompleted.new(fixture.to_json)
|
|
1148
|
+
json = model.to_h
|
|
1149
|
+
assert_kind_of Hash, json
|
|
1150
|
+
assert_equal fixture["id"], json[:id]
|
|
1151
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1152
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1153
|
+
end
|
|
1154
|
+
|
|
1155
|
+
def test_resource_export_completed_data_round_trip
|
|
1156
|
+
fixture = {
|
|
1157
|
+
"id" => "stub",
|
|
1158
|
+
"resource_type" => "stub"
|
|
1159
|
+
}
|
|
1160
|
+
model = WorkOS::ResourceExportCompletedData.new(fixture.to_json)
|
|
1161
|
+
json = model.to_h
|
|
1162
|
+
assert_kind_of Hash, json
|
|
1163
|
+
assert_equal fixture["id"], json[:id]
|
|
1164
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1165
|
+
end
|
|
1166
|
+
|
|
1167
|
+
def test_resource_export_created_round_trip
|
|
1168
|
+
fixture = {
|
|
1169
|
+
"object" => "event",
|
|
1170
|
+
"id" => "stub",
|
|
1171
|
+
"event" => "resource_export.created",
|
|
1172
|
+
"data" => {},
|
|
1173
|
+
"created_at" => "stub",
|
|
1174
|
+
"context" => {}
|
|
1175
|
+
}
|
|
1176
|
+
model = WorkOS::ResourceExportCreated.new(fixture.to_json)
|
|
1177
|
+
json = model.to_h
|
|
1178
|
+
assert_kind_of Hash, json
|
|
1179
|
+
assert_equal fixture["id"], json[:id]
|
|
1180
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1181
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1182
|
+
end
|
|
1183
|
+
|
|
1184
|
+
def test_resource_export_created_data_round_trip
|
|
1185
|
+
fixture = {
|
|
1186
|
+
"id" => "stub",
|
|
1187
|
+
"resource_type" => "stub"
|
|
1188
|
+
}
|
|
1189
|
+
model = WorkOS::ResourceExportCreatedData.new(fixture.to_json)
|
|
1190
|
+
json = model.to_h
|
|
1191
|
+
assert_kind_of Hash, json
|
|
1192
|
+
assert_equal fixture["id"], json[:id]
|
|
1193
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1194
|
+
end
|
|
1195
|
+
|
|
1196
|
+
def test_resource_export_downloaded_round_trip
|
|
1197
|
+
fixture = {
|
|
1198
|
+
"object" => "event",
|
|
1199
|
+
"id" => "stub",
|
|
1200
|
+
"event" => "resource_export.downloaded",
|
|
1201
|
+
"data" => {},
|
|
1202
|
+
"created_at" => "stub",
|
|
1203
|
+
"context" => {}
|
|
1204
|
+
}
|
|
1205
|
+
model = WorkOS::ResourceExportDownloaded.new(fixture.to_json)
|
|
1206
|
+
json = model.to_h
|
|
1207
|
+
assert_kind_of Hash, json
|
|
1208
|
+
assert_equal fixture["id"], json[:id]
|
|
1209
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1210
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1211
|
+
end
|
|
1212
|
+
|
|
1213
|
+
def test_resource_export_downloaded_data_round_trip
|
|
1214
|
+
fixture = {
|
|
1215
|
+
"id" => "stub",
|
|
1216
|
+
"resource_type" => "stub"
|
|
1217
|
+
}
|
|
1218
|
+
model = WorkOS::ResourceExportDownloadedData.new(fixture.to_json)
|
|
1219
|
+
json = model.to_h
|
|
1220
|
+
assert_kind_of Hash, json
|
|
1221
|
+
assert_equal fixture["id"], json[:id]
|
|
1222
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1223
|
+
end
|
|
1224
|
+
|
|
1225
|
+
def test_resource_export_failed_round_trip
|
|
1226
|
+
fixture = {
|
|
1227
|
+
"object" => "event",
|
|
1228
|
+
"id" => "stub",
|
|
1229
|
+
"event" => "resource_export.failed",
|
|
1230
|
+
"data" => {},
|
|
1231
|
+
"created_at" => "stub",
|
|
1232
|
+
"context" => {}
|
|
1233
|
+
}
|
|
1234
|
+
model = WorkOS::ResourceExportFailed.new(fixture.to_json)
|
|
1235
|
+
json = model.to_h
|
|
1236
|
+
assert_kind_of Hash, json
|
|
1237
|
+
assert_equal fixture["id"], json[:id]
|
|
1238
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
1239
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1240
|
+
end
|
|
1241
|
+
|
|
1242
|
+
def test_resource_export_failed_data_round_trip
|
|
1243
|
+
fixture = {
|
|
1244
|
+
"id" => "stub",
|
|
1245
|
+
"resource_type" => "stub"
|
|
1246
|
+
}
|
|
1247
|
+
model = WorkOS::ResourceExportFailedData.new(fixture.to_json)
|
|
1248
|
+
json = model.to_h
|
|
1249
|
+
assert_kind_of Hash, json
|
|
1250
|
+
assert_equal fixture["id"], json[:id]
|
|
1251
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
1252
|
+
end
|
|
1253
|
+
|
|
807
1254
|
def test_waitlist_user_approved_round_trip
|
|
808
1255
|
fixture = {
|
|
809
1256
|
"object" => "event",
|
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])
|