Sha256: e16c97824a532e48bba6a15a165fd0e31b7de29a8be2f2766dd8599056244b80

Contents?: true

Size: 1.13 KB

Versions: 5

Compression:

Stored size: 1.13 KB

Contents

require 'test_helper'
require 'simple_aws/mechanical_turk'

describe SimpleAWS::MechanicalTurk do

  before do
    @api = SimpleAWS::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 = SimpleAWS::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
      SimpleAWS::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 = SimpleAWS::MechanicalTurk.new "key", "secret"
      obj.SearchHITs
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
simple_aws-1.2.3 test/simple_aws/mechanical_turk_test.rb
simple_aws-1.2.2 test/simple_aws/mechanical_turk_test.rb
simple_aws-1.2.1 test/simple_aws/mechanical_turk_test.rb
simple_aws-1.2.0 test/simple_aws/mechanical_turk_test.rb
simple_aws-1.1.0 test/simple_aws/mechanical_turk_test.rb