From fd0653ffa90a1504fee5f3dcfa958429c13d3e25 Mon Sep 17 00:00:00 2001 From: Paul Bonser Date: Tue, 23 Jun 2015 15:05:28 -0500 Subject: [PATCH] Update tests to handle *Response rather than Response --- goes_test.go | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/goes_test.go b/goes_test.go index 3334d30..0ae5605 100644 --- a/goes_test.go +++ b/goes_test.go @@ -5,13 +5,14 @@ package goes import ( - . "gopkg.in/check.v1" "net/http" "net/url" "os" "strings" "testing" "time" + + . "gopkg.in/check.v1" ) var ( @@ -155,7 +156,7 @@ func (s *GoesTestSuite) TestDeleteIndexInexistantIndex(c *C) { resp, err := conn.DeleteIndex("foobar") c.Assert(err.Error(), Equals, "[404] IndexMissingException[[foobar] missing]") - c.Assert(resp, DeepEquals, Response{}) + c.Assert(resp, DeepEquals, &Response{}) } func (s *GoesTestSuite) TestDeleteIndexExistingIndex(c *C) { @@ -170,7 +171,7 @@ func (s *GoesTestSuite) TestDeleteIndexExistingIndex(c *C) { resp, err := conn.DeleteIndex(indexName) c.Assert(err, IsNil) - expectedResponse := Response{} + expectedResponse := &Response{} expectedResponse.Acknowledged = true resp.Raw = nil c.Assert(resp, DeepEquals, expectedResponse) @@ -377,7 +378,7 @@ func (s *GoesTestSuite) TestIndexWithFieldsInStruct(c *C) { response, err := conn.Index(d, extraArgs) c.Assert(err, IsNil) - expectedResponse := Response{ + expectedResponse := &Response{ Index: indexName, Id: docId, Type: docType, @@ -442,7 +443,7 @@ func (s *GoesTestSuite) TestIndexIdDefined(c *C) { response, err := conn.Index(d, extraArgs) c.Assert(err, IsNil) - expectedResponse := Response{ + expectedResponse := &Response{ Index: indexName, Id: docId, Type: docType, @@ -511,7 +512,7 @@ func (s *GoesTestSuite) TestDelete(c *C) { response, err := conn.Delete(d, url.Values{}) c.Assert(err, IsNil) - expectedResponse := Response{ + expectedResponse := &Response{ Found: true, Index: indexName, Type: docType, @@ -525,7 +526,7 @@ func (s *GoesTestSuite) TestDelete(c *C) { response, err = conn.Delete(d, url.Values{}) c.Assert(err, IsNil) - expectedResponse = Response{ + expectedResponse = &Response{ Found: false, Index: indexName, Type: docType, @@ -586,7 +587,7 @@ func (s *GoesTestSuite) TestDeleteByQuery(c *C) { c.Assert(err, IsNil) - expectedResponse := Response{ + expectedResponse := &Response{ Found: false, Index: "", Type: "", @@ -631,7 +632,7 @@ func (s *GoesTestSuite) TestGet(c *C) { response, err := conn.Get(indexName, docType, docId, url.Values{}) c.Assert(err, IsNil) - expectedResponse := Response{ + expectedResponse := &Response{ Index: indexName, Type: docType, Id: docId, @@ -648,7 +649,7 @@ func (s *GoesTestSuite) TestGet(c *C) { response, err = conn.Get(indexName, docType, docId, fields) c.Assert(err, IsNil) - expectedResponse = Response{ + expectedResponse = &Response{ Index: indexName, Type: docType, Id: docId, @@ -1141,7 +1142,7 @@ func (s *GoesTestSuite) TestUpdate(c *C) { c.Assert(err, IsNil) time.Sleep(200 * time.Millisecond) - expectedResponse := Response{ + expectedResponse := &Response{ Index: indexName, Id: docId, Type: docType, @@ -1310,7 +1311,7 @@ func (s *GoesTestSuite) TestAddAlias(c *C) { response, err := conn.Get(aliasName, docType, docId, url.Values{}) c.Assert(err, IsNil) - expectedResponse := Response{ + expectedResponse := &Response{ Index: indexName, Type: docType, Id: docId,