access_token_test.rb 643 B

1234567891011121314151617181920
  1. # frozen_string_literal: true
  2. require 'test_helper'
  3. class AccessTokenTest < Test::Unit::TestCase
  4. def test_delegate_access_token
  5. fake(
  6. "access_tokens/delegate.json?delegate_access_scope%5B%5D=write_orders&" \
  7. "delegate_access_scope%5B%5D=read_products&expires_in=",
  8. method: :post,
  9. status: 201,
  10. body: load_fixture('access_token_delegate'),
  11. extension: false
  12. )
  13. delegate_scope = ['write_orders', 'read_products']
  14. token = ShopifyAPI::AccessToken.delegate(delegate_scope)
  15. assert_equal('abracadabra', token.access_token)
  16. assert_equal('write_orders,read_products', token.scope)
  17. end
  18. end