access_token_test.rb 613 B

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