Sha256: 90973442d1fe4841d1bb74fa12dac8a27bca93babab62fd1c4fb9506c2660217

Contents?: true

Size: 1.74 KB

Versions: 4

Compression:

Stored size: 1.74 KB

Contents

require 'spec_helper'

describe MWS::API::Query do 
  before do
    @query = MWS::API::Query.new(default_params)
    @query.stub!(:signature).and_return("SIGNATURE")
  end

  context ".query" do
    it "should assemble the canonical query" do
      @query.canonical.should == %Q{GET
mws.amazonservices.com
/Orders/2011-01-01
AWSAccessKeyId=#{default_params[:aws_access_key_id]}&Action=ListOrders&LastUpdatedAfter=2012-01-13T15%3A48%3A55-05%3A00&MarketplaceId.Id.1=#{default_params[:marketplace_id]}&SellerId=#{default_params[:seller_id]}&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-01-14T15%3A48%3A55-05%3A00&Version=2011-01-01}
    end
  end

  context ".request_uri" do
    it "should assemble the request uri" do
      @query.request_uri.should == "https://mws.amazonservices.com/Orders/2011-01-01?AWSAccessKeyId=#{default_params[:aws_access_key_id]}&Action=ListOrders&LastUpdatedAfter=2012-01-13T15%3A48%3A55-05%3A00&MarketplaceId.Id.1=#{default_params[:marketplace_id]}&SellerId=#{default_params[:seller_id]}&Signature=SIGNATURE&SignatureMethod=HmacSHA256&SignatureVersion=2&Timestamp=2012-01-14T15%3A48%3A55-05%3A00&Version=2011-01-01"
    end
  end

  def default_params
    # some random keys
    params = {
      :last_updated_after => "2012-01-13T15:48:55-05:00",
      :verb               => :get,
      :uri                => "/Orders/2011-01-01",
      :version            => "2011-01-01",
      :host               => "mws.amazonservices.com",
      :action             => "ListOrders",
      :signature_method   => "HmacSHA256",
      :signature_version  => "2",
      :timestamp          => "2012-01-14T15:48:55-05:00",
      :lists              => {
        :marketplace_id   => "MarketplaceId.Id"
      }
    }.merge(auth_params)
  end

end
  

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-mws-0.1 spec/ruby-mws/api/query_spec.rb
ruby-mws-0.0.4 spec/ruby-mws/api/query_spec.rb
ruby-mws-0.0.3 spec/ruby-mws/api/query_spec.rb
ruby-mws-0.0.2 spec/ruby-mws/api/query_spec.rb