From b1240be5ea24aae2a5ba5cce2173095137c7c833 Mon Sep 17 00:00:00 2001 From: Ami Mahloof Date: Thu, 5 Sep 2024 10:08:24 -0400 Subject: [PATCH] fix tests --- lib/descope/mixins/http.rb | 9 +++++++-- .../lib.descope/api/v1/management/user_spec.rb | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/lib/descope/mixins/http.rb b/lib/descope/mixins/http.rb index 4890d8f..d09e330 100644 --- a/lib/descope/mixins/http.rb +++ b/lib/descope/mixins/http.rb @@ -44,10 +44,15 @@ def retry_options } end - def safe_parse_json(body, cookies: nil) + def safe_parse_json(body, cookies: {}) @logger.debug "response => #{JSON.parse(body.to_s)}" res = JSON.parse(body.to_s) - res['cookies'] = cookies unless cookies.nil? + cookies.each do |cookie_name, cookie_value| + if cookie_name == REFRESH_SESSION_COOKIE_NAME + res['cookies'] ||= {} + res['cookies'][cookie_name] = cookie_value + end + end res rescue JSON::ParserError body diff --git a/spec/integration/lib.descope/api/v1/management/user_spec.rb b/spec/integration/lib.descope/api/v1/management/user_spec.rb index bfa424e..e32e054 100644 --- a/spec/integration/lib.descope/api/v1/management/user_spec.rb +++ b/spec/integration/lib.descope/api/v1/management/user_spec.rb @@ -212,7 +212,7 @@ @client.expire_password(user['loginIds'][0]) @client.password_sign_in(login_id: user['loginIds'][0], password:) rescue Descope::ServerError => e - expect(e.message).to match(/"errorCode":"E062903"/) + expect(e.message).to match(/"errorCode":"E062909"/) end end @@ -227,7 +227,7 @@ @client.set_password(login_id: user['loginIds'][0], password: new_password) @client.password_sign_in(login_id: user['loginIds'][0], password:) rescue Descope::ServerError => e - expect(e.message).to match(/"errorDescription":"Password signin failed"/) + expect(e.message).to match(/"Password expired"/) end end