Sha256: 98656e425fb436c482ad04af7e35314649c63ae5116b89599bbf9fc4aae6e45f

Contents?: true

Size: 1.36 KB

Versions: 8

Compression:

Stored size: 1.36 KB

Contents

require 'test_helper'

class ShopifyApiTest < Test::Unit::TestCase
  
  context "Session" do
    should "not be valid without a url" do
      session = ShopifyAPI::Session.new(nil, "any-token")
      assert_not session.valid?
    end
    
    should "not be valid without token" do
      session = ShopifyAPI::Session.new("testshop.myshopify.com")
      assert_not session.valid?
    end

    should "be valid with any token and any url" do
      session = ShopifyAPI::Session.new("testshop.myshopify.com", "any-token")
      assert session.valid?
    end
    
    should "not raise error without params" do
      assert_nothing_raised do
        session = ShopifyAPI::Session.new("testshop.myshopify.com", "any-token")
      end
    end
    
    should "raise error if params passed but signature omitted" do
      assert_raises(RuntimeError) do
        session = ShopifyAPI::Session.new("testshop.myshopify.com", "any-token", {'foo' => 'bar'})
      end
    end

    should "setup api_key and secret for all sessions" do
      ShopifyAPI::Session.setup(:api_key => "My test key", :secret => "My test secret")
      assert_equal "My test key", ShopifyAPI::Session.api_key
      assert_equal "My test secret", ShopifyAPI::Session.secret
    end
    
    should "use 'https' protocol by default for all sessions" do
      assert_equal 'https', ShopifyAPI::Session.protocol
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
shopify_api-1.2.5 test/shopify_api_test.rb
shopify_api-1.2.2 test/shopify_api_test.rb
shopify_api-1.2.1 test/shopify_api_test.rb
shopify_api-1.2.0 test/shopify_api_test.rb
shopify_api-1.1.3 test/shopify_api_test.rb
shopify_api-1.1.2 test/shopify_api_test.rb
shopify_api-1.1.1 test/shopify_api_test.rb
shopify_api-1.1.0 test/shopify_api_test.rb