From ea86184675145d7c9d26fae319e66775d7fc888c Mon Sep 17 00:00:00 2001 From: Shivam Mishra Date: Fri, 31 May 2024 18:49:22 +0530 Subject: [PATCH] fix: tests --- .../microsoft/callbacks_controller.rb | 12 +++++----- app/controllers/oauth_callback_controller.rb | 23 ++++++++----------- 2 files changed, 15 insertions(+), 20 deletions(-) diff --git a/app/controllers/microsoft/callbacks_controller.rb b/app/controllers/microsoft/callbacks_controller.rb index e87deba83..f5dd8d68e 100644 --- a/app/controllers/microsoft/callbacks_controller.rb +++ b/app/controllers/microsoft/callbacks_controller.rb @@ -1,4 +1,10 @@ class Microsoft::CallbacksController < OauthCallbackController + private + + def provider_name + 'microsoft' + end + def handle_response inbox, already_exists = find_or_create_inbox ::Redis::Alfred.delete(users_data['email'].downcase) @@ -10,12 +16,6 @@ class Microsoft::CallbacksController < OauthCallbackController end end - private - - def provider_name - 'microsoft' - end - def oauth_client app_id = GlobalConfigService.load('AZURE_APP_ID', nil) app_secret = GlobalConfigService.load('AZURE_APP_SECRET', nil) diff --git a/app/controllers/oauth_callback_controller.rb b/app/controllers/oauth_callback_controller.rb index ab78700b7..cb3549cce 100644 --- a/app/controllers/oauth_callback_controller.rb +++ b/app/controllers/oauth_callback_controller.rb @@ -13,6 +13,14 @@ class OauthCallbackController < ApplicationController private + def provider_name + raise NotImplementedError + end + + def oauth_client + raise NotImplementedError + end + def oauth_code params[:code] end @@ -22,19 +30,6 @@ class OauthCallbackController < ApplicationController end def parsed_body - @parsed_body ||= Rack::Utils.parse_nested_query(@response.raw_response.body) - end - - # These methods should be implemented in the subclasses - def oauth_client - raise NotImplementedError - end - - def provider_name - raise NotImplementedError - end - - def handle_response - raise NotImplementedError + @parsed_body ||= @response.response.parsed end end