Sha256: a05851ea08778bb65e8eef7df0580e954b872c1ba344f0ecc16e32e964ed9e86

Contents?: true

Size: 1.17 KB

Versions: 40

Compression:

Stored size: 1.17 KB

Contents

require 'test_helper'

class StorefrontAccessTokenTest < Test::Unit::TestCase

  def test_create_storefront_access_token
    fake "storefront_access_tokens", :method => :post, :body => load_fixture('storefront_access_token')
    storefront_access_token = ShopifyAPI::StorefrontAccessToken.create(title: 'Test')
    assert_equal 1, storefront_access_token.id
    assert_equal "Test", storefront_access_token.title
  end

  def test_delete_storefront_access_token
    fake 'storefront_access_tokens/1', method: :get, status: 200, body: load_fixture('storefront_access_token')
    fake 'storefront_access_tokens/1', method: :delete, status: 200, body: 'destroyed'
    
    storefront_access_tokens = ShopifyAPI::StorefrontAccessToken.find(1)
    assert storefront_access_tokens.destroy
  end

  def test_get_storefront_access_tokens
    fake "storefront_access_tokens", method: :get, status: 201, body: load_fixture('storefront_access_tokens')

    tokens = ShopifyAPI::StorefrontAccessToken.all

    assert_equal 2, tokens.size
    assert_equal 1, tokens.first.id
    assert_equal 2, tokens.last.id
    assert_equal 'Test 1', tokens.first.title
    assert_equal 'Test 2', tokens.last.title
  end

end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
shopify_api-9.2.0 test/storefront_access_token_test.rb
shopify_api-9.1.0 test/storefront_access_token_test.rb
shopify_api-9.0.4 test/storefront_access_token_test.rb
shopify_api-9.0.3 test/storefront_access_token_test.rb
shopify_api-9.0.2 test/storefront_access_token_test.rb
shopify_api-9.0.1 test/storefront_access_token_test.rb
shopify_api-9.0.0 test/storefront_access_token_test.rb
shopify_api-8.1.0 test/storefront_access_token_test.rb
shopify_api-8.0.0 test/storefront_access_token_test.rb
shopify_api-7.1.0 test/storefront_access_token_test.rb
shopify_api-7.0.2 test/storefront_access_token_test.rb
shopify_api-7.0.1 test/storefront_access_token_test.rb
shopify_api-7.0.0 test/storefront_access_token_test.rb
shopify_api-6.0.0 test/storefront_access_token_test.rb
shopify_api-5.2.4 test/storefront_access_token_test.rb
shopify_api-5.2.3 test/storefront_access_token_test.rb
shopify_api-5.2.2 test/storefront_access_token_test.rb
shopify_api-5.2.1 test/storefront_access_token_test.rb
shopify_api-5.2.0 test/storefront_access_token_test.rb
shopify_api-5.1.0 test/storefront_access_token_test.rb