Skip to content

Commit bdf9b6c

Browse files
committed
Add test
1 parent 511daf9 commit bdf9b6c

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/auth/oauth_test.rb

+9-2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,13 @@ def test_begin_auth_online
8585
verify_oauth_begin(auth_route: result[:auth_route], cookie: result[:cookie], is_online: true)
8686
end
8787

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+
8895
def test_begin_auth_context_not_setup
8996
modify_context(api_key: "", api_secret_key: "", host_name: "")
9097

@@ -280,10 +287,10 @@ def test_validate_auth_callback_save_session_fails
280287

281288
private
282289

283-
def verify_oauth_begin(auth_route:, cookie:, is_online:)
290+
def verify_oauth_begin(auth_route:, cookie:, is_online:, scope: ShopifyAPI::Context.scope)
284291
expected_query_params = {
285292
client_id: ShopifyAPI::Context.api_key,
286-
scope: ShopifyAPI::Context.scope.to_s,
293+
scope: scope.to_s,
287294
redirect_uri: "https://#{ShopifyAPI::Context.host_name}/redirect",
288295
"grant_options[]": is_online ? "per-user" : "",
289296
}

0 commit comments

Comments
 (0)