Sha256: 671191b37576aca52d9fe389d4de7257103888a79438b5d6af399bfd8f8ec0a9

Contents?: true

Size: 1.09 KB

Versions: 7

Compression:

Stored size: 1.09 KB

Contents

require 'test_helper'
require 'aws/mechanical_turk'

describe AWS::MechanicalTurk do

  before do
    @api = AWS::MechanicalTurk.new "key", "secret"
  end

  it "points to the endpoint" do
    @api.uri.must_equal "https://mechanicalturk.amazonaws.com"
  end

  it "works with the current version" do
    @api.version.must_equal "2011-10-01"
  end

  it "can be told to work in sandbox mode" do
    api = AWS::MechanicalTurk.new "key", "secret", true
    api.uri.must_equal "https://mechanicalturk.sandbox.amazonaws.com"
  end

  describe "API calls" do

    it "builds and signs calls with Operation and Service" do
      AWS::Connection.any_instance.expects(:call).with do |request|
        params = request.params
        params.wont_be_nil

        params["Operation"].must_equal "SearchHITs"
        params["Service"].must_equal "AWSMechanicalTurkRequester"
        params["AWSAccessKeyId"].must_equal "key"
        params["Version"].must_equal "2011-10-01"
        params["Signature"].wont_be_nil

        true
      end

      obj = AWS::MechanicalTurk.new "key", "secret"
      obj.SearchHITs
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
simple_aws-1.0.0 test/aws/mechanical_turk_test.rb
simple_aws-1.0.0.pre3 test/aws/mechanical_turk_test.rb
simple_aws-1.0.0.pre2 test/aws/mechanical_turk_test.rb
simple_aws-1.0.0.pre1 test/aws/mechanical_turk_test.rb
simple_aws-0.0.1d test/aws/mechanical_turk_test.rb
simple_aws-0.0.1c test/aws/mechanical_turk_test.rb
simple_aws-0.0.1b test/aws/mechanical_turk_test.rb