Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
lizkenyon committed Dec 18, 2023
1 parent 550d39b commit a76ad14
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/clients/base_rest_resource_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

require_relative "../test_helper"
require "shopify_api"
require "pry-byebug"

module ShopifyAPITest
module Rest
Expand Down
9 changes: 9 additions & 0 deletions test/clients/http_client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ def test_request_with_api_host_set
.to_return(body: "", headers: @response_headers, status: 204)

verify_http_request

ShopifyAPI::Context.setup(
api_key: "key",
api_secret_key: "secret",
api_version: "2023-10",
scope: ["scope1", "scope2"],
is_private: true,
is_embedded: true,
)
end

def test_request_using_active_session
Expand Down
13 changes: 13 additions & 0 deletions test/context_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ def test_setup
assert_equal("http", ShopifyAPI::Context.host_scheme)
assert_equal("localhost", ShopifyAPI::Context.host_name)
assert_equal("example.com", ShopifyAPI::Context.api_host)

ShopifyAPI::Context.setup(
api_key: "key",
api_secret_key: "secret",
api_version: "2023-10",
scope: ["scope1", "scope2"],
is_private: true,
is_embedded: true,
log_level: :off,
private_shop: "privateshop.myshopify.com",
user_agent_prefix: "user_agent_prefix1",
old_api_secret_key: "old_secret",
)
end

def test_active_session_is_thread_safe
Expand Down
5 changes: 4 additions & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def setup
user_agent_prefix: T.nilable(String),
old_api_secret_key: T.nilable(String),
response_as_struct: T.nilable(T::Boolean),
api_host: T.nilable(String),
).void
end
def modify_context(
Expand All @@ -66,7 +67,8 @@ def modify_context(
private_shop: "do-not-set",
user_agent_prefix: nil,
old_api_secret_key: nil,
response_as_struct: nil
response_as_struct: nil,
api_host: nil
)
ShopifyAPI::Context.setup(
api_key: api_key ? api_key : ShopifyAPI::Context.api_key,
Expand All @@ -82,6 +84,7 @@ def modify_context(
old_api_secret_key: old_api_secret_key ? old_api_secret_key : ShopifyAPI::Context.old_api_secret_key,
log_level: :off,
response_as_struct: response_as_struct || ShopifyAPI::Context.response_as_struct,
api_host: api_host || ShopifyAPI::Context.api_host,
)
end
end
Expand Down

0 comments on commit a76ad14

Please sign in to comment.