コード例 #1
0
ファイル: mturkclient_test.go プロジェクト: jiakuan/goamz
// Test if performing a request invokes the MTurkss configured
// http.Client
func (s *ClientSuite) TestClientUsed(c *C) {
	transport := &FlaggingRoundTripper{false, http.DefaultTransport}
	instance := mturk.MTurkWithClient(s.auth, &http.Client{Transport: transport})
	u, err := url.Parse(testServer.URL)
	if err != nil {
		panic(err.Error())
	}
	instance.URL = u
	testServer.PrepareResponse(200, nil, BasicHitResponse)
	question := mturk.ExternalQuestion{
		ExternalURL: "http://www.amazon.com",
		FrameHeight: 200,
	}
	reward := mturk.Price{
		Amount:       "0.01",
		CurrencyCode: "USD",
	}
	hit, err := instance.CreateHIT("title", "description", question, reward, 1, 2, "key1,key2", 3, nil, "annotation")
	testServer.WaitRequest()
	c.Assert(err, IsNil)
	c.Assert(hit, NotNil)
	c.Assert(transport.Transported, Equals, true)
}
コード例 #2
0
ファイル: mturkclient_test.go プロジェクト: jiakuan/goamz
// Test if MTurkWithClient returns an MTurk
func (s *ClientSuite) TestWithClient(c *C) {
	instance := mturk.MTurkWithClient(s.auth, &http.Client{})
	c.Assert(instance, NotNil)
}