@@ -85,6 +85,13 @@ def test_begin_auth_online
85
85
verify_oauth_begin ( auth_route : result [ :auth_route ] , cookie : result [ :cookie ] , is_online : true )
86
86
end
87
87
88
+ def test_custom_scope
89
+ result = ShopifyAPI ::Auth ::Oauth . begin_auth ( shop : @shop , redirect_path : "/redirect" ,
90
+ scope : ShopifyAPI ::Auth ::AuthScopes . new ( "read_orders,write_products" ) )
91
+ verify_oauth_begin ( auth_route : result [ :auth_route ] , cookie : result [ :cookie ] , is_online : true ,
92
+ scope : "read_orders,write_products" )
93
+ end
94
+
88
95
def test_begin_auth_context_not_setup
89
96
modify_context ( api_key : "" , api_secret_key : "" , host_name : "" )
90
97
@@ -280,10 +287,10 @@ def test_validate_auth_callback_save_session_fails
280
287
281
288
private
282
289
283
- def verify_oauth_begin ( auth_route :, cookie :, is_online :)
290
+ def verify_oauth_begin ( auth_route :, cookie :, is_online :, scope : ShopifyAPI :: Context . scope )
284
291
expected_query_params = {
285
292
client_id : ShopifyAPI ::Context . api_key ,
286
- scope : ShopifyAPI :: Context . scope . to_s ,
293
+ scope : scope . to_s ,
287
294
redirect_uri : "https://#{ ShopifyAPI ::Context . host_name } /redirect" ,
288
295
"grant_options[]" : is_online ? "per-user" : "" ,
289
296
}
0 commit comments