From 73efe197646d3ad65f1045f9b6749ddc8002d505 Mon Sep 17 00:00:00 2001 From: r4cc00n Date: Fri, 19 Nov 2021 13:58:23 +0100 Subject: [PATCH 1/7] reactivate user added reactivate post added reactivate test --- lib/oktakit/client/users.rb | 18 ++++++++++++++++++ spec/client/users_spec.rb | 9 +++++++++ 2 files changed, 27 insertions(+) diff --git a/lib/oktakit/client/users.rb b/lib/oktakit/client/users.rb index 74aae5f..9c23299 100644 --- a/lib/oktakit/client/users.rb +++ b/lib/oktakit/client/users.rb @@ -131,6 +131,24 @@ def activate_user(id, options = {}) post("/users/#{id}/lifecycle/activate", options) end + # Reactivate User + # + # @params id [string] User ID + # @param options[:query] [Hash] Optional. Query params for request + # @param options[:headers] [Hash] Optional. Header params for the request. + # @param options[:accept] [String] Optional. The content type to accept. Default application/json + # @param options[:content_type] [String] Optional. The content type for the request. Default application/json + # @param options [Hash] Optional. Body params for request. + # @return [Hash] Returns empty object by default. If sendEmail is false, a user reactivation link. + # @note The user must be in a PROVISIONED status + # @see https://developer.okta.com/docs/reference/api/users/#reactivate-user + # @example + # Oktakit.reactivate_user('id') + + def reactivate_user(id, options = {}) + post("/users/#{id}/lifecycle/reactivate", options) + end + # Deactivate User # # @params id [string] User ID diff --git a/spec/client/users_spec.rb b/spec/client/users_spec.rb index 2f0716e..6e0df96 100644 --- a/spec/client/users_spec.rb +++ b/spec/client/users_spec.rb @@ -121,6 +121,15 @@ end end + describe '#reactivate_user' do + it 'returns empty object by default.' do + VCR.use_cassette('reactivate_user') do + resp, = client.reactivate_user(USERS_USER_ID) + expect(resp.to_h).to(be == {}) + end + end + end + describe '#deactivate_user' do it 'returns an empty object.' do VCR.use_cassette('deactivate_user') do From fed72a4401cb4843e818d10993dace12fdbe0ff2 Mon Sep 17 00:00:00 2001 From: r4cc00n Date: Mon, 22 Nov 2021 14:09:15 +0100 Subject: [PATCH 2/7] delete user added delete_user (delete) added delete_user test --- lib/oktakit/client/users.rb | 18 ++++++++++++++++++ spec/client/users_spec.rb | 9 +++++++++ 2 files changed, 27 insertions(+) diff --git a/lib/oktakit/client/users.rb b/lib/oktakit/client/users.rb index 9c23299..882fad6 100644 --- a/lib/oktakit/client/users.rb +++ b/lib/oktakit/client/users.rb @@ -165,6 +165,24 @@ def deactivate_user(id, options = {}) post("/users/#{id}/lifecycle/deactivate", options) end + # Delete User + # + # @params id [string] User ID + # @param options[:query] [Hash] Optional. Query params for request + # @param options[:headers] [Hash] Optional. Header params for the request. + # @param options[:accept] [String] Optional. The content type to accept. Default application/json + # @param options[:content_type] [String] Optional. The content type for the request. Default application/json + # @param options [Hash] Optional. Body params for request. + # @return [Hash] Returns an empty object. + # @note Deletes a user permanently. This operation can only be performed on users that have a DEPROVISIONED status. This action cannot be recovered! + # This operation on a user that hasn't been deactivated causes that user to be deactivated. A second delete operation is required to delete the user. + # @see https://developer.okta.com/docs/api/resources/users#deactivate-user + # @example + # Oktakit.delete_user('id') + def delete_user(id, options = {}) + delete("/users/#{id}", options) + end + # Suspend User # # @params id [string] User ID diff --git a/spec/client/users_spec.rb b/spec/client/users_spec.rb index 6e0df96..35bcf08 100644 --- a/spec/client/users_spec.rb +++ b/spec/client/users_spec.rb @@ -139,6 +139,15 @@ end end + describe '#delete_user' do + it 'returns an empty object.' do + VCR.use_cassette('delete_user') do + resp, = client.delete_user(USERS_USER_ID) + expect(resp.to_h).to(be == {}) + end + end + end + describe '#suspend_user' do it 'returns an empty object.' do VCR.use_cassette('suspend_user') do From 18627d7fd6c4c2d4d7bd2956379e79d82898684c Mon Sep 17 00:00:00 2001 From: r4cc00n Date: Mon, 22 Nov 2021 16:58:17 +0100 Subject: [PATCH 3/7] reactivate user added proper vcr cassette for reactivation of an user --- spec/cassettes/reactivate_user.yml | 71 ++++++++++++++++++++++++++++++ spec/client/users_spec.rb | 7 +-- 2 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 spec/cassettes/reactivate_user.yml diff --git a/spec/cassettes/reactivate_user.yml b/spec/cassettes/reactivate_user.yml new file mode 100644 index 0000000..146e279 --- /dev/null +++ b/spec/cassettes/reactivate_user.yml @@ -0,0 +1,71 @@ +--- +http_interactions: +- request: + method: post + uri: https://okta-test.okta.com/api/v1/users/00u6o0w6tyuPVEeZr0h7/lifecycle/reactivate + body: + encoding: UTF-8 + string: "{}" + headers: + User-Agent: + - Oktakit v0.2.1 + Accept: + - application/json + Content-Type: + - application/json + Authorization: + - SSWS 00AmrrD0Mvd5eVIzaP6wr9BsDDFOUu61zWytQ2yf5o + response: + status: + code: 200 + message: + headers: + date: + - Mon, 22 Nov 2021 15:41:34 GMT + content-type: + - application/json + transfer-encoding: + - chunked + connection: + - keep-alive + server: + - nginx + public-key-pins-report-only: + - pin-sha256="jZomPEBSDXoipA9un78hKRIeN/+U4ZteRaiX8YpWfqc="; pin-sha256="axSbM6RQ+19oXxudaOTdwXJbSr6f7AahxbDHFy3p8s8="; + pin-sha256="SE4qe2vdD9tAegPwO79rMnZyhHvqj3i5g1c2HkyGUNE="; pin-sha256="ylP0lMLMvBaiHn0ihLxHjzvlPVQNoyQ+rMiaj0da/Pw="; + max-age=60; report-uri="https://okta.report-uri.com/r/default/hpkp/reportOnly" + vary: + - Accept-Encoding + x-okta-request-id: + - YZu6LeHdLZlyG1fg5pfS@AAAA44 + x-xss-protection: + - '0' + p3p: + - CP="HONK" + x-rate-limit-limit: + - '600' + x-rate-limit-remaining: + - '599' + x-rate-limit-reset: + - '1637595753' + cache-control: + - no-cache, no-store + pragma: + - no-cache + expires: + - '0' + expect-ct: + - report-uri="https://oktaexpectct.report-uri.com/r/t/ct/reportOnly", max-age=0 + x-content-type-options: + - nosniff + strict-transport-security: + - max-age=315360000; includeSubDomains + set-cookie: + - sid=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, JSESSIONID=D47AF9D36773B7390C6E69915A514E7D; + Path=/; Secure; HttpOnly + body: + encoding: UTF-8 + string: '{"activationToken":"-9OhPWRjr7_S8t2iV5_w"}' + http_version: + recorded_at: Mon, 22 Nov 2021 15:41:34 GMT +recorded_with: VCR 2.9.3 diff --git a/spec/client/users_spec.rb b/spec/client/users_spec.rb index 6e0df96..5b7ea0f 100644 --- a/spec/client/users_spec.rb +++ b/spec/client/users_spec.rb @@ -122,10 +122,11 @@ end describe '#reactivate_user' do - it 'returns empty object by default.' do + it 'returns activation token by default.' do VCR.use_cassette('reactivate_user') do - resp, = client.reactivate_user(USERS_USER_ID) - expect(resp.to_h).to(be == {}) + resp, status = client.reactivate_user(USERS_USER_ID) + expect(status).to(be == 200) + expect(resp[:activationToken]).to (be == '-9OhPWRjr7_S8t2iV5_w') end end end From 566bcc7b13e0742d7100081e34c8b5a25a5ea1c9 Mon Sep 17 00:00:00 2001 From: r4cc00n Date: Mon, 22 Nov 2021 19:37:42 +0100 Subject: [PATCH 4/7] delete user added proper vcr cassette for user deletion --- spec/cassettes/delete_user.yml | 65 ++++++++++++++++++++++++++++++++++ spec/client/users_spec.rb | 5 +-- 2 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 spec/cassettes/delete_user.yml diff --git a/spec/cassettes/delete_user.yml b/spec/cassettes/delete_user.yml new file mode 100644 index 0000000..06a1f22 --- /dev/null +++ b/spec/cassettes/delete_user.yml @@ -0,0 +1,65 @@ +--- +http_interactions: +- request: + method: delete + uri: https://okta-test.okta.com/api/v1/users/00u6o0w6tyuPVEeZr0h7 + body: + encoding: UTF-8 + string: "{}" + headers: + User-Agent: + - Oktakit v0.2.1 + Accept: + - application/json + Content-Type: + - application/json + Authorization: + - SSWS 00AmrrD0Mvd5eVIzaP6wr9BsDDFOUu61zWytQ2yf5o + response: + status: + code: 204 + message: + headers: + date: + - Mon, 22 Nov 2021 18:28:44 GMT + connection: + - keep-alive + server: + - nginx + public-key-pins-report-only: + - pin-sha256="jZomPEBSDXoipA9un78hKRIeN/+U4ZteRaiX8YpWfqc="; pin-sha256="axSbM6RQ+19oXxudaOTdwXJbSr6f7AahxbDHFy3p8s8="; + pin-sha256="SE4qe2vdD9tAegPwO79rMnZyhHvqj3i5g1c2HkyGUNE="; pin-sha256="ylP0lMLMvBaiHn0ihLxHjzvlPVQNoyQ+rMiaj0da/Pw="; + max-age=60; report-uri="https://okta.report-uri.com/r/default/hpkp/reportOnly" + x-okta-request-id: + - YZvhXNDEXRFjP5tqu8tyYwAADP4 + x-xss-protection: + - '0' + p3p: + - CP="HONK" + x-rate-limit-limit: + - '600' + x-rate-limit-remaining: + - '599' + x-rate-limit-reset: + - '1637605784' + cache-control: + - no-cache, no-store + pragma: + - no-cache + expires: + - '0' + expect-ct: + - report-uri="https://oktaexpectct.report-uri.com/r/t/ct/reportOnly", max-age=0 + x-frame-options: + - SAMEORIGIN + strict-transport-security: + - max-age=315360000; includeSubDomains + set-cookie: + - sid=""; Expires=Thu, 01-Jan-1970 00:00:10 GMT; Path=/, JSESSIONID=71EBF44305F41332FD492D6DF26BB174; + Path=/; Secure; HttpOnly + body: + encoding: UTF-8 + string: '' + http_version: + recorded_at: Mon, 22 Nov 2021 18:28:44 GMT +recorded_with: VCR 2.9.3 diff --git a/spec/client/users_spec.rb b/spec/client/users_spec.rb index 35bcf08..ed1513e 100644 --- a/spec/client/users_spec.rb +++ b/spec/client/users_spec.rb @@ -142,8 +142,9 @@ describe '#delete_user' do it 'returns an empty object.' do VCR.use_cassette('delete_user') do - resp, = client.delete_user(USERS_USER_ID) - expect(resp.to_h).to(be == {}) + resp, status = client.delete_user(USERS_USER_ID) + expect(resp).to(be_empty) + expect(status).to(be == 204) end end end From 63eb85590733ecc64632c5f4b7626df93cd53f40 Mon Sep 17 00:00:00 2001 From: r4cc00n Date: Mon, 22 Nov 2021 19:42:44 +0100 Subject: [PATCH 5/7] house keeping --- spec/client/users_spec.rb | 146 +++++++++++++++++++------------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/spec/client/users_spec.rb b/spec/client/users_spec.rb index 2885259..5067c86 100644 --- a/spec/client/users_spec.rb +++ b/spec/client/users_spec.rb @@ -1,11 +1,11 @@ -require 'spec_helper' +require "spec_helper" describe Oktakit::Client::Users do - USERS_USER_ID = '00u6o0w6tyuPVEeZr0h7' + USERS_USER_ID = "00u6o0w6tyuPVEeZr0h7" - describe '#create_user' do - it 'returns all responses return the created user.' do - VCR.use_cassette('create_user') do + describe "#create_user" do + it "returns all responses return the created user." do + VCR.use_cassette("create_user") do resp, = client.create_user( profile: { firstName: "Example", @@ -26,9 +26,9 @@ end end - describe '#get_user' do - it 'returns fetched user' do - VCR.use_cassette('get_user') do + describe "#get_user" do + it "returns fetched user" do + VCR.use_cassette("get_user") do resp, = client.get_user(USERS_USER_ID) expect(resp.to_h).to(have_key(:id)) expect(resp.to_h).to(have_key(:profile)) @@ -39,18 +39,18 @@ end end - describe '#list_users' do - it 'returns array of user' do - VCR.use_cassette('list_users') do + describe "#list_users" do + it "returns array of user" do + VCR.use_cassette("list_users") do resp, = client.list_users expect(resp).to(be_a(Array)) end end end - describe '#update_user' do - it 'returns updated user' do - VCR.use_cassette('update_user') do + describe "#update_user" do + it "returns updated user" do + VCR.use_cassette("update_user") do resp, = client.update_user(USERS_USER_ID, profile: { firstName: "Bob", @@ -58,14 +58,14 @@ email: "example@example.com", login: "example@example.com", }) - expect(resp.profile.firstName).to(be == 'Bob') + expect(resp.profile.firstName).to(be == "Bob") end end end - describe '#update_user partial' do - it 'returns updated user' do - VCR.use_cassette('update_user_partial') do + describe "#update_user partial" do + it "returns updated user" do + VCR.use_cassette("update_user_partial") do resp, = client.update_user(USERS_USER_ID, profile: { firstName: "Bob", @@ -74,14 +74,14 @@ login: "example@example.com", }, partial: true) - expect(resp.profile.firstName).to(be == 'Bob') + expect(resp.profile.firstName).to(be == "Bob") end end end - describe '#update_profile' do - it 'returns updated user' do - VCR.use_cassette('update_profile') do + describe "#update_profile" do + it "returns updated user" do + VCR.use_cassette("update_profile") do resp, = client.update_profile(USERS_USER_ID, profile: { firstName: "Other Bob", @@ -89,60 +89,60 @@ email: "example@example.com", login: "example@example.com", }) - expect(resp.profile.firstName).to(be == 'Other Bob') + expect(resp.profile.firstName).to(be == "Other Bob") end end end - describe '#get_assigned_app_links' do - it 'returns array of app links' do - VCR.use_cassette('get_assigned_app_links') do + describe "#get_assigned_app_links" do + it "returns array of app links" do + VCR.use_cassette("get_assigned_app_links") do resp, = client.get_assigned_app_links(USERS_USER_ID) expect(resp).to(be_a(Array)) end end end - describe '#get_member_groups' do - it 'returns array of groups' do - VCR.use_cassette('get_member_groups') do + describe "#get_member_groups" do + it "returns array of groups" do + VCR.use_cassette("get_member_groups") do resp, = client.get_member_groups(USERS_USER_ID) expect(resp).to(be_a(Array)) end end end - describe '#activate_user' do - it 'returns empty object by default.' do - VCR.use_cassette('activate_user') do + describe "#activate_user" do + it "returns empty object by default." do + VCR.use_cassette("activate_user") do resp, = client.activate_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe '#reactivate_user' do - it 'returns activation token by default.' do - VCR.use_cassette('reactivate_user') do + describe "#reactivate_user" do + it "returns activation token by default." do + VCR.use_cassette("reactivate_user") do resp, status = client.reactivate_user(USERS_USER_ID) expect(status).to(be == 200) - expect(resp[:activationToken]).to (be == '-9OhPWRjr7_S8t2iV5_w') + expect(resp[:activationToken]).to(be == "-9OhPWRjr7_S8t2iV5_w") end end end - describe '#deactivate_user' do - it 'returns an empty object.' do - VCR.use_cassette('deactivate_user') do + describe "#deactivate_user" do + it "returns an empty object." do + VCR.use_cassette("deactivate_user") do resp, = client.deactivate_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe '#delete_user' do - it 'returns an empty object.' do - VCR.use_cassette('delete_user') do + describe "#delete_user" do + it "returns an empty object." do + VCR.use_cassette("delete_user") do resp, status = client.delete_user(USERS_USER_ID) expect(resp).to(be_empty) expect(status).to(be == 204) @@ -150,63 +150,63 @@ end end - describe '#suspend_user' do - it 'returns an empty object.' do - VCR.use_cassette('suspend_user') do + describe "#suspend_user" do + it "returns an empty object." do + VCR.use_cassette("suspend_user") do resp, = client.suspend_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe '#unsuspend_user' do - it 'returns an empty object. returns an empty object.' do - VCR.use_cassette('unsuspend_user') do + describe "#unsuspend_user" do + it "returns an empty object. returns an empty object." do + VCR.use_cassette("unsuspend_user") do resp, = client.unsuspend_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe '#unlock_user' do - it 'returns an empty object' do - VCR.use_cassette('unlock_user') do + describe "#unlock_user" do + it "returns an empty object" do + VCR.use_cassette("unlock_user") do _, status = client.unlock_user(USERS_USER_ID) expect(status).to(be(200)) end end end - describe '#reset_password' do - it 'returns an empty object by default.' do - VCR.use_cassette('reset_password') do + describe "#reset_password" do + it "returns an empty object by default." do + VCR.use_cassette("reset_password") do resp, = client.reset_password(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe '#expire_password' do - it 'returns the complete user object by default.' do - VCR.use_cassette('expire_password') do + describe "#expire_password" do + it "returns the complete user object by default." do + VCR.use_cassette("expire_password") do resp, = client.expire_password(USERS_USER_ID) - expect(resp.status).to(be == 'PASSWORD_EXPIRED') + expect(resp.status).to(be == "PASSWORD_EXPIRED") end end end - describe '#reset_factors' do - it 'returns an empty object by default.' do - VCR.use_cassette('reset_factors') do + describe "#reset_factors" do + it "returns an empty object by default." do + VCR.use_cassette("reset_factors") do resp, = client.reset_factors(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe '#forgot_password' do - it 'returns an empty object by default.' do - VCR.use_cassette('forgot_password') do + describe "#forgot_password" do + it "returns an empty object by default." do + VCR.use_cassette("forgot_password") do resp, = client.forgot_password( USERS_USER_ID, password: { value: "123Password!" }, @@ -217,9 +217,9 @@ end end - describe '#change_password' do - it 'returns credentials of the user' do - VCR.use_cassette('change_password') do + describe "#change_password" do + it "returns credentials of the user" do + VCR.use_cassette("change_password") do _, status = client.change_password(USERS_USER_ID, oldPassword: { value: "uTVM,TPw55" }, newPassword: { value: "NewPassword1234!" }) @@ -228,9 +228,9 @@ end end - describe '#change_recovery_question' do - it 'returns credentials of the user' do - VCR.use_cassette('change_recovery_question') do + describe "#change_recovery_question" do + it "returns credentials of the user" do + VCR.use_cassette("change_recovery_question") do resp, = client.change_recovery_question(USERS_USER_ID, password: { value: "NewPassword1234!" }, recovery_question: { @@ -242,9 +242,9 @@ end end - describe '#clear_user_sessions' do - it 'returns 204 no content' do - VCR.use_cassette('clear_user_sessions') do + describe "#clear_user_sessions" do + it "returns 204 no content" do + VCR.use_cassette("clear_user_sessions") do _, status = client.clear_user_sessions(USERS_USER_ID) expect(status).to(be(204)) end From 431cb397d90d8f5c8194196a0dd37b80c6002719 Mon Sep 17 00:00:00 2001 From: r4cc00n Date: Mon, 22 Nov 2021 21:00:54 +0100 Subject: [PATCH 6/7] fixed documentation --- lib/oktakit/client/users.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/oktakit/client/users.rb b/lib/oktakit/client/users.rb index 882fad6..c4512d4 100644 --- a/lib/oktakit/client/users.rb +++ b/lib/oktakit/client/users.rb @@ -139,7 +139,7 @@ def activate_user(id, options = {}) # @param options[:accept] [String] Optional. The content type to accept. Default application/json # @param options[:content_type] [String] Optional. The content type for the request. Default application/json # @param options [Hash] Optional. Body params for request. - # @return [Hash] Returns empty object by default. If sendEmail is false, a user reactivation link. + # @return [Hash]. # @note The user must be in a PROVISIONED status # @see https://developer.okta.com/docs/reference/api/users/#reactivate-user # @example @@ -172,11 +172,11 @@ def deactivate_user(id, options = {}) # @param options[:headers] [Hash] Optional. Header params for the request. # @param options[:accept] [String] Optional. The content type to accept. Default application/json # @param options[:content_type] [String] Optional. The content type for the request. Default application/json - # @param options [Hash] Optional. Body params for request. - # @return [Hash] Returns an empty object. + # @param options [Hash] Optional. Body params for the request. + # @return 204 'No Content' # @note Deletes a user permanently. This operation can only be performed on users that have a DEPROVISIONED status. This action cannot be recovered! # This operation on a user that hasn't been deactivated causes that user to be deactivated. A second delete operation is required to delete the user. - # @see https://developer.okta.com/docs/api/resources/users#deactivate-user + # @see https://developer.okta.com/docs/reference/api/users/#delete-user # @example # Oktakit.delete_user('id') def delete_user(id, options = {}) From 92cdc366c9443b8eba9e89a43294a73e212c471a Mon Sep 17 00:00:00 2001 From: r4cc00n Date: Mon, 22 Nov 2021 21:43:18 +0100 Subject: [PATCH 7/7] fixed automatic rubocop offenses --- spec/client/users_spec.rb | 146 +++++++++++++++++++------------------- 1 file changed, 73 insertions(+), 73 deletions(-) diff --git a/spec/client/users_spec.rb b/spec/client/users_spec.rb index 5067c86..a936d3a 100644 --- a/spec/client/users_spec.rb +++ b/spec/client/users_spec.rb @@ -1,11 +1,11 @@ -require "spec_helper" +require 'spec_helper' describe Oktakit::Client::Users do - USERS_USER_ID = "00u6o0w6tyuPVEeZr0h7" + USERS_USER_ID = '00u6o0w6tyuPVEeZr0h7' - describe "#create_user" do - it "returns all responses return the created user." do - VCR.use_cassette("create_user") do + describe '#create_user' do + it 'returns all responses return the created user.' do + VCR.use_cassette('create_user') do resp, = client.create_user( profile: { firstName: "Example", @@ -26,9 +26,9 @@ end end - describe "#get_user" do - it "returns fetched user" do - VCR.use_cassette("get_user") do + describe '#get_user' do + it 'returns fetched user' do + VCR.use_cassette('get_user') do resp, = client.get_user(USERS_USER_ID) expect(resp.to_h).to(have_key(:id)) expect(resp.to_h).to(have_key(:profile)) @@ -39,18 +39,18 @@ end end - describe "#list_users" do - it "returns array of user" do - VCR.use_cassette("list_users") do + describe '#list_users' do + it 'returns array of user' do + VCR.use_cassette('list_users') do resp, = client.list_users expect(resp).to(be_a(Array)) end end end - describe "#update_user" do - it "returns updated user" do - VCR.use_cassette("update_user") do + describe '#update_user' do + it 'returns updated user' do + VCR.use_cassette('update_user') do resp, = client.update_user(USERS_USER_ID, profile: { firstName: "Bob", @@ -58,14 +58,14 @@ email: "example@example.com", login: "example@example.com", }) - expect(resp.profile.firstName).to(be == "Bob") + expect(resp.profile.firstName).to(be == 'Bob') end end end - describe "#update_user partial" do - it "returns updated user" do - VCR.use_cassette("update_user_partial") do + describe '#update_user partial' do + it 'returns updated user' do + VCR.use_cassette('update_user_partial') do resp, = client.update_user(USERS_USER_ID, profile: { firstName: "Bob", @@ -74,14 +74,14 @@ login: "example@example.com", }, partial: true) - expect(resp.profile.firstName).to(be == "Bob") + expect(resp.profile.firstName).to(be == 'Bob') end end end - describe "#update_profile" do - it "returns updated user" do - VCR.use_cassette("update_profile") do + describe '#update_profile' do + it 'returns updated user' do + VCR.use_cassette('update_profile') do resp, = client.update_profile(USERS_USER_ID, profile: { firstName: "Other Bob", @@ -89,60 +89,60 @@ email: "example@example.com", login: "example@example.com", }) - expect(resp.profile.firstName).to(be == "Other Bob") + expect(resp.profile.firstName).to(be == 'Other Bob') end end end - describe "#get_assigned_app_links" do - it "returns array of app links" do - VCR.use_cassette("get_assigned_app_links") do + describe '#get_assigned_app_links' do + it 'returns array of app links' do + VCR.use_cassette('get_assigned_app_links') do resp, = client.get_assigned_app_links(USERS_USER_ID) expect(resp).to(be_a(Array)) end end end - describe "#get_member_groups" do - it "returns array of groups" do - VCR.use_cassette("get_member_groups") do + describe '#get_member_groups' do + it 'returns array of groups' do + VCR.use_cassette('get_member_groups') do resp, = client.get_member_groups(USERS_USER_ID) expect(resp).to(be_a(Array)) end end end - describe "#activate_user" do - it "returns empty object by default." do - VCR.use_cassette("activate_user") do + describe '#activate_user' do + it 'returns empty object by default.' do + VCR.use_cassette('activate_user') do resp, = client.activate_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#reactivate_user" do - it "returns activation token by default." do - VCR.use_cassette("reactivate_user") do + describe '#reactivate_user' do + it 'returns activation token by default.' do + VCR.use_cassette('reactivate_user') do resp, status = client.reactivate_user(USERS_USER_ID) expect(status).to(be == 200) - expect(resp[:activationToken]).to(be == "-9OhPWRjr7_S8t2iV5_w") + expect(resp[:activationToken]).to(be == '-9OhPWRjr7_S8t2iV5_w') end end end - describe "#deactivate_user" do - it "returns an empty object." do - VCR.use_cassette("deactivate_user") do + describe '#deactivate_user' do + it 'returns an empty object.' do + VCR.use_cassette('deactivate_user') do resp, = client.deactivate_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#delete_user" do - it "returns an empty object." do - VCR.use_cassette("delete_user") do + describe '#delete_user' do + it 'returns an empty object.' do + VCR.use_cassette('delete_user') do resp, status = client.delete_user(USERS_USER_ID) expect(resp).to(be_empty) expect(status).to(be == 204) @@ -150,63 +150,63 @@ end end - describe "#suspend_user" do - it "returns an empty object." do - VCR.use_cassette("suspend_user") do + describe '#suspend_user' do + it 'returns an empty object.' do + VCR.use_cassette('suspend_user') do resp, = client.suspend_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#unsuspend_user" do - it "returns an empty object. returns an empty object." do - VCR.use_cassette("unsuspend_user") do + describe '#unsuspend_user' do + it 'returns an empty object. returns an empty object.' do + VCR.use_cassette('unsuspend_user') do resp, = client.unsuspend_user(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#unlock_user" do - it "returns an empty object" do - VCR.use_cassette("unlock_user") do + describe '#unlock_user' do + it 'returns an empty object' do + VCR.use_cassette('unlock_user') do _, status = client.unlock_user(USERS_USER_ID) expect(status).to(be(200)) end end end - describe "#reset_password" do - it "returns an empty object by default." do - VCR.use_cassette("reset_password") do + describe '#reset_password' do + it 'returns an empty object by default.' do + VCR.use_cassette('reset_password') do resp, = client.reset_password(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#expire_password" do - it "returns the complete user object by default." do - VCR.use_cassette("expire_password") do + describe '#expire_password' do + it 'returns the complete user object by default.' do + VCR.use_cassette('expire_password') do resp, = client.expire_password(USERS_USER_ID) - expect(resp.status).to(be == "PASSWORD_EXPIRED") + expect(resp.status).to(be == 'PASSWORD_EXPIRED') end end end - describe "#reset_factors" do - it "returns an empty object by default." do - VCR.use_cassette("reset_factors") do + describe '#reset_factors' do + it 'returns an empty object by default.' do + VCR.use_cassette('reset_factors') do resp, = client.reset_factors(USERS_USER_ID) expect(resp.to_h).to(be == {}) end end end - describe "#forgot_password" do - it "returns an empty object by default." do - VCR.use_cassette("forgot_password") do + describe '#forgot_password' do + it 'returns an empty object by default.' do + VCR.use_cassette('forgot_password') do resp, = client.forgot_password( USERS_USER_ID, password: { value: "123Password!" }, @@ -217,9 +217,9 @@ end end - describe "#change_password" do - it "returns credentials of the user" do - VCR.use_cassette("change_password") do + describe '#change_password' do + it 'returns credentials of the user' do + VCR.use_cassette('change_password') do _, status = client.change_password(USERS_USER_ID, oldPassword: { value: "uTVM,TPw55" }, newPassword: { value: "NewPassword1234!" }) @@ -228,9 +228,9 @@ end end - describe "#change_recovery_question" do - it "returns credentials of the user" do - VCR.use_cassette("change_recovery_question") do + describe '#change_recovery_question' do + it 'returns credentials of the user' do + VCR.use_cassette('change_recovery_question') do resp, = client.change_recovery_question(USERS_USER_ID, password: { value: "NewPassword1234!" }, recovery_question: { @@ -242,9 +242,9 @@ end end - describe "#clear_user_sessions" do - it "returns 204 no content" do - VCR.use_cassette("clear_user_sessions") do + describe '#clear_user_sessions' do + it 'returns 204 no content' do + VCR.use_cassette('clear_user_sessions') do _, status = client.clear_user_sessions(USERS_USER_ID) expect(status).to(be(204)) end