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
|
@@ -67,6 +67,41 @@ class OrganizationsTest < Minitest::Test
|
|
|
67
67
|
assert_kind_of WorkOS::Types::ListStruct, result
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
+
def test_list_it_contacts_returns_expected_result
|
|
71
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts(\?|\z)})
|
|
72
|
+
.to_return(body: '{"data": [], "list_metadata": {}}', status: 200)
|
|
73
|
+
result = @client.organizations.list_it_contacts(organization_id: "stub")
|
|
74
|
+
assert_kind_of WorkOS::Types::ListStruct, result
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
def test_create_it_contact_returns_expected_result
|
|
78
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts(\?|\z)})
|
|
79
|
+
.to_return(body: "{}", status: 200)
|
|
80
|
+
result = @client.organizations.create_it_contact(organization_id: "stub", email: "stub")
|
|
81
|
+
refute_nil result
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def test_delete_it_contact_returns_expected_result
|
|
85
|
+
stub_request(:delete, %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub(\?|\z)})
|
|
86
|
+
.to_return(body: "{}", status: 200)
|
|
87
|
+
result = @client.organizations.delete_it_contact(organization_id: "stub", contact_id: "stub")
|
|
88
|
+
assert_nil result
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
def test_invite_it_contact_returns_expected_result
|
|
92
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub/invite(\?|\z)})
|
|
93
|
+
.to_return(body: "{}", status: 200)
|
|
94
|
+
result = @client.organizations.invite_it_contact(organization_id: "stub", contact_id: "stub", intents: ["stub"])
|
|
95
|
+
assert_nil result
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def test_revoke_it_contact_returns_expected_result
|
|
99
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub/revoke(\?|\z)})
|
|
100
|
+
.to_return(body: "{}", status: 200)
|
|
101
|
+
result = @client.organizations.revoke_it_contact(organization_id: "stub", contact_id: "stub")
|
|
102
|
+
assert_nil result
|
|
103
|
+
end
|
|
104
|
+
|
|
70
105
|
# Parameterized authentication error tests (one per endpoint).
|
|
71
106
|
[
|
|
72
107
|
{name: :list_organizations, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations(\?|\z)}},
|
|
@@ -76,7 +111,12 @@ class OrganizationsTest < Minitest::Test
|
|
|
76
111
|
{name: :update_organization, verb: :put, url: %r{\Ahttps://api\.workos\.com/organizations/stub(\?|\z)}, args: {id: "stub"}},
|
|
77
112
|
{name: :delete_organization, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub(\?|\z)}, args: {id: "stub"}},
|
|
78
113
|
{name: :get_audit_log_configuration, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/audit_log_configuration(\?|\z)}, args: {id: "stub"}},
|
|
79
|
-
{name: :list_authorized_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/authorized_applications(\?|\z)}, args: {organization_id: "stub"}}
|
|
114
|
+
{name: :list_authorized_applications, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/authorized_applications(\?|\z)}, args: {organization_id: "stub"}},
|
|
115
|
+
{name: :list_it_contacts, verb: :get, url: %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts(\?|\z)}, args: {organization_id: "stub"}},
|
|
116
|
+
{name: :create_it_contact, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts(\?|\z)}, args: {organization_id: "stub", email: "stub"}},
|
|
117
|
+
{name: :delete_it_contact, verb: :delete, url: %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub(\?|\z)}, args: {organization_id: "stub", contact_id: "stub"}},
|
|
118
|
+
{name: :invite_it_contact, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub/invite(\?|\z)}, args: {organization_id: "stub", contact_id: "stub", intents: ["stub"]}},
|
|
119
|
+
{name: :revoke_it_contact, verb: :post, url: %r{\Ahttps://api\.workos\.com/organizations/stub/it_contacts/stub/revoke(\?|\z)}, args: {organization_id: "stub", contact_id: "stub"}}
|
|
80
120
|
].each do |spec|
|
|
81
121
|
define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
|
|
82
122
|
stub_request(spec[:verb], spec[:url])
|
|
@@ -7,12 +7,33 @@ require "test_helper"
|
|
|
7
7
|
class OrganizationsModelRoundTripTest < Minitest::Test
|
|
8
8
|
def test_update_audit_logs_retention_round_trip
|
|
9
9
|
fixture = {
|
|
10
|
+
"retention_period" => "stub",
|
|
10
11
|
"retention_period_in_days" => 1
|
|
11
12
|
}
|
|
12
13
|
model = WorkOS::UpdateAuditLogsRetention.new(fixture.to_json)
|
|
13
14
|
json = model.to_h
|
|
14
15
|
assert_kind_of Hash, json
|
|
15
|
-
|
|
16
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def test_create_it_contact_round_trip
|
|
20
|
+
fixture = {
|
|
21
|
+
"email" => "stub"
|
|
22
|
+
}
|
|
23
|
+
model = WorkOS::CreateItContact.new(fixture.to_json)
|
|
24
|
+
json = model.to_h
|
|
25
|
+
assert_kind_of Hash, json
|
|
26
|
+
assert_equal fixture["email"], json[:email]
|
|
27
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_invite_it_contact_round_trip
|
|
31
|
+
fixture = {
|
|
32
|
+
"intents" => []
|
|
33
|
+
}
|
|
34
|
+
model = WorkOS::InviteItContact.new(fixture.to_json)
|
|
35
|
+
json = model.to_h
|
|
36
|
+
assert_kind_of Hash, json
|
|
16
37
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
17
38
|
end
|
|
18
39
|
|
|
@@ -544,6 +565,24 @@ class OrganizationsModelRoundTripTest < Minitest::Test
|
|
|
544
565
|
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
545
566
|
end
|
|
546
567
|
|
|
568
|
+
def test_it_contact_round_trip
|
|
569
|
+
fixture = {
|
|
570
|
+
"object" => "it_contact",
|
|
571
|
+
"id" => "stub",
|
|
572
|
+
"email" => "stub",
|
|
573
|
+
"created_at" => "stub",
|
|
574
|
+
"updated_at" => "stub"
|
|
575
|
+
}
|
|
576
|
+
model = WorkOS::ItContact.new(fixture.to_json)
|
|
577
|
+
json = model.to_h
|
|
578
|
+
assert_kind_of Hash, json
|
|
579
|
+
assert_equal fixture["id"], json[:id]
|
|
580
|
+
assert_equal fixture["email"], json[:email]
|
|
581
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
582
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
583
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
584
|
+
end
|
|
585
|
+
|
|
547
586
|
def test_organization_round_trip
|
|
548
587
|
fixture = {
|
|
549
588
|
"object" => "organization",
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "test_helper"
|
|
6
|
+
|
|
7
|
+
class PlatformTeamsTest < Minitest::Test
|
|
8
|
+
include FixtureHelper
|
|
9
|
+
|
|
10
|
+
def setup
|
|
11
|
+
@client = WorkOS::Client.new(api_key: "sk_test_123")
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def test_create_team_returns_expected_result
|
|
15
|
+
stub_request(:post, %r{\Ahttps://api\.workos\.com/platform/teams(\?|\z)})
|
|
16
|
+
.to_return(body: "{}", status: 200)
|
|
17
|
+
result = @client.platform_teams.create_team(admin_email: "stub", name: "stub")
|
|
18
|
+
refute_nil result
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_get_team_returns_expected_result
|
|
22
|
+
stub_request(:get, %r{\Ahttps://api\.workos\.com/platform/teams/stub(\?|\z)})
|
|
23
|
+
.to_return(body: "{}", status: 200)
|
|
24
|
+
result = @client.platform_teams.get_team(team_id: "stub")
|
|
25
|
+
refute_nil result
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Parameterized authentication error tests (one per endpoint).
|
|
29
|
+
[
|
|
30
|
+
{name: :create_team, verb: :post, url: %r{\Ahttps://api\.workos\.com/platform/teams(\?|\z)}, args: {admin_email: "stub", name: "stub"}},
|
|
31
|
+
{name: :get_team, verb: :get, url: %r{\Ahttps://api\.workos\.com/platform/teams/stub(\?|\z)}, args: {team_id: "stub"}}
|
|
32
|
+
].each do |spec|
|
|
33
|
+
define_method("test_#{spec[:name]}_raises_authentication_error_on_401") do
|
|
34
|
+
stub_request(spec[:verb], spec[:url])
|
|
35
|
+
.to_return(body: '{"message": "Unauthorized"}', status: 401)
|
|
36
|
+
assert_raises(WorkOS::AuthenticationError) do
|
|
37
|
+
@client.platform_teams.send(spec[:name], **(spec[:args] || {}))
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# This file is auto-generated by oagen. Do not edit.
|
|
4
|
+
|
|
5
|
+
require "test_helper"
|
|
6
|
+
|
|
7
|
+
class PlatformTeamsModelRoundTripTest < Minitest::Test
|
|
8
|
+
def test_create_team_round_trip
|
|
9
|
+
fixture = {
|
|
10
|
+
"admin_email" => "stub",
|
|
11
|
+
"name" => "stub"
|
|
12
|
+
}
|
|
13
|
+
model = WorkOS::CreateTeam.new(fixture.to_json)
|
|
14
|
+
json = model.to_h
|
|
15
|
+
assert_kind_of Hash, json
|
|
16
|
+
assert_equal fixture["admin_email"], json[:admin_email]
|
|
17
|
+
assert_equal fixture["name"], json[:name]
|
|
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_team_round_trip
|
|
22
|
+
fixture = {
|
|
23
|
+
"object" => "team",
|
|
24
|
+
"id" => "stub",
|
|
25
|
+
"name" => "stub",
|
|
26
|
+
"production_state" => "stub",
|
|
27
|
+
"production_enabled_at" => nil,
|
|
28
|
+
"created_at" => "stub",
|
|
29
|
+
"updated_at" => "stub"
|
|
30
|
+
}
|
|
31
|
+
model = WorkOS::Team.new(fixture.to_json)
|
|
32
|
+
json = model.to_h
|
|
33
|
+
assert_kind_of Hash, json
|
|
34
|
+
assert_equal fixture["id"], json[:id]
|
|
35
|
+
assert_equal fixture["name"], json[:name]
|
|
36
|
+
assert_nil json[:production_enabled_at]
|
|
37
|
+
assert_equal fixture["created_at"], json[:created_at]
|
|
38
|
+
assert_equal fixture["updated_at"], json[:updated_at]
|
|
39
|
+
fixture.each_key { |k| assert json.key?(k.to_sym) || json.key?(k), "Expected to_h to include key #{k}" }
|
|
40
|
+
end
|
|
41
|
+
end
|
|
@@ -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",
|