@@ -170,103 +170,6 @@ class CallbackControllerTest < ActionController::TestCase
170170 refute_equal cookies . encrypted [ @stubbed_cookie . name ] , @stubbed_cookie . value
171171 end
172172
173- test "#callback starts the WebhooksManager if webhooks are configured" do
174- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
175- ShopifyApp . configure do |config |
176- config . webhooks = [ { topic : "carts/update" , address : "example-app.com/webhooks" } ]
177- end
178-
179- ShopifyApp ::WebhooksManager . expects ( :queue ) . with ( SHOP_DOMAIN , "token" )
180-
181- mock_oauth
182- get :callback , params : @callback_params
183- end
184-
185- test "#callback doesn't run the WebhooksManager if no webhooks are configured" do
186- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
187- ShopifyApp . configure do |config |
188- config . webhooks = [ ]
189- end
190-
191- ShopifyApp ::WebhooksManager . expects ( :queue ) . never
192-
193- mock_oauth
194- get :callback , params : @callback_params
195- end
196-
197- test "#callback calls #perform_after_authenticate_job and performs inline when inline is true" do
198- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
199- ShopifyApp . configure do |config |
200- config . after_authenticate_job = { job : Shopify ::AfterAuthenticateJob , inline : true }
201- end
202-
203- Shopify ::AfterAuthenticateJob . expects ( :perform_now ) . with ( shop_domain : SHOP_DOMAIN )
204-
205- mock_oauth
206- get :callback , params : @callback_params
207- end
208-
209- test "#callback calls #perform_after_authenticate_job and performs asynchronous when inline isn't true" do
210- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
211- ShopifyApp . configure do |config |
212- config . after_authenticate_job = { job : Shopify ::AfterAuthenticateJob , inline : false }
213- end
214-
215- Shopify ::AfterAuthenticateJob . expects ( :perform_later ) . with ( shop_domain : SHOP_DOMAIN )
216-
217- mock_oauth
218- get :callback , params : @callback_params
219- end
220-
221- test "#callback doesn't call #perform_after_authenticate_job if job is nil" do
222- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
223- ShopifyApp . configure do |config |
224- config . after_authenticate_job = { job : nil , inline : false }
225- end
226-
227- Shopify ::AfterAuthenticateJob . expects ( :perform_later ) . never
228-
229- mock_oauth
230- get :callback , params : @callback_params
231- end
232-
233- test "#callback calls #perform_after_authenticate_job and performs async if inline isn't present" do
234- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
235- ShopifyApp . configure do |config |
236- config . after_authenticate_job = { job : Shopify ::AfterAuthenticateJob }
237- end
238-
239- Shopify ::AfterAuthenticateJob . expects ( :perform_later ) . with ( shop_domain : SHOP_DOMAIN )
240-
241- mock_oauth
242- get :callback , params : @callback_params
243- end
244-
245- test "#callback calls #perform_after_authenticate_job constantizes from a string to a class" do
246- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
247- ShopifyApp . configure do |config |
248- config . after_authenticate_job = { job : "Shopify::AfterAuthenticateJob" , inline : false }
249- end
250-
251- Shopify ::AfterAuthenticateJob . expects ( :perform_later ) . with ( shop_domain : SHOP_DOMAIN )
252-
253- mock_oauth
254- get :callback , params : @callback_params
255- end
256-
257- test "#callback calls #perform_after_authenticate_job raises if the string is not a valid job class" do
258- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
259- ShopifyApp . configure do |config |
260- config . after_authenticate_job = { job : "InvalidJobClassThatDoesNotExist" , inline : false }
261- end
262-
263- mock_oauth
264-
265- assert_raise NameError do
266- get :callback , params : @callback_params
267- end
268- end
269-
270173 test "#callback redirects to the root_url with shop and host parameter for non-embedded" do
271174 ShopifyApp . configuration . embedded_app = false
272175 ShopifyAppConfigurer . setup_context # to reset the context, as there's no attr_writer for embedded
@@ -305,52 +208,6 @@ class CallbackControllerTest < ActionController::TestCase
305208 assert_redirected_to "https://#{ @host } /admin/apps/key/return_to/path"
306209 end
307210
308- test "#callback performs install_webhook job after authentication" do
309- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
310- mock_oauth
311-
312- ShopifyApp . configure do |config |
313- config . webhooks = [ { topic : "carts/update" , address : "example-app.com/webhooks" } ]
314- end
315-
316- ShopifyApp ::WebhooksManager . expects ( :queue ) . with ( SHOP_DOMAIN , "token" )
317-
318- get :callback , params : @callback_params
319- assert_response 302
320- end
321-
322- test "#callback performs install_webhook job with an offline session after an online session OAuth" do
323- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
324- ShopifyApp . configure do |config |
325- config . webhooks = [ { topic : "carts/update" , address : "example-app.com/webhooks" } ]
326- end
327- ShopifyApp ::SessionRepository . shop_storage . store ( @stubbed_session )
328- ShopifyApp ::SessionRepository . user_storage = ShopifyApp ::InMemoryUserSessionStore
329-
330- mock_oauth ( session : online_session )
331-
332- ShopifyApp ::WebhooksManager . expects ( :queue ) . with ( SHOP_DOMAIN , "token" )
333-
334- get :callback , params : @callback_params
335- assert_response 302
336- ensure
337- ShopifyApp ::SessionRepository . shop_storage . clear
338- end
339-
340- test "#callback performs after_authenticate job after authentication" do
341- # Deprecated in 23.0, tests moved to PostAuthenticateTasksTest
342- mock_oauth
343-
344- ShopifyApp . configure do |config |
345- config . after_authenticate_job = { job : Shopify ::AfterAuthenticateJob , inline : true }
346- end
347-
348- Shopify ::AfterAuthenticateJob . expects ( :perform_now ) . with ( shop_domain : SHOP_DOMAIN )
349-
350- get :callback , params : @callback_params
351- assert_response 302
352- end
353-
354211 test "#callback calls post_authenticate_tasks if custom_post_authenticate_tasks is set" do
355212 mock_oauth
356213
@@ -377,20 +234,6 @@ class CallbackControllerTest < ActionController::TestCase
377234 assert_response 302
378235 end
379236
380- test "#callback calls methods in callback controller if custom_post_authenticate_tasks is not set" do
381- mock_oauth
382-
383- ShopifyApp . configure do |_config |
384- ShopifyApp . configuration . custom_post_authenticate_tasks = nil
385- end
386-
387- CallbackController . any_instance . expects ( :install_webhooks )
388- CallbackController . any_instance . expects ( :perform_after_authenticate_job )
389-
390- get :callback , params : @callback_params
391- assert_response 302
392- end
393-
394237 private
395238
396239 def mock_oauth ( cookie : @stubbed_cookie , session : @stubbed_session )
0 commit comments