http_client_test.rb 794 B

1234567891011121314151617181920212223242526
  1. # frozen_string_literal: true
  2. require 'test_helper'
  3. module GraphQL
  4. class HTTPClientTest < Test::Unit::TestCase
  5. test '#headers uses the Base headers' do
  6. ShopifyAPI::Base.headers['X-Custom'] = 'abc'
  7. client = ShopifyAPI::GraphQL::HTTPClient.new('2019-07')
  8. assert_equal 'abc', client.headers({})['X-Custom']
  9. ShopifyAPI::Base.headers.delete('X-Custom')
  10. end
  11. test '#uri uses the Base site and the API version' do
  12. ShopifyAPI::Base.site = 'https://foo:bar@www.zombo.com'
  13. api_version = ShopifyAPI::ApiVersion.new(handle: '2019-07')
  14. client = ShopifyAPI::GraphQL::HTTPClient.new(api_version)
  15. expected_uri = URI('https://foo:bar@www.zombo.com/admin/api/2019-07/graphql.json')
  16. assert_equal expected_uri, client.uri
  17. end
  18. end
  19. end