Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ami-descope committed Sep 5, 2024
1 parent 789ed19 commit b1240be
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions lib/descope/mixins/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/integration/lib.descope/api/v1/management/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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

Expand Down

0 comments on commit b1240be

Please sign in to comment.