Update tests to handle *Response rather than Response
This commit is contained in:
parent
e46905c0b4
commit
fd0653ffa9
25
goes_test.go
25
goes_test.go
@ -5,13 +5,14 @@
|
|||||||
package goes
|
package goes
|
||||||
|
|
||||||
import (
|
import (
|
||||||
. "gopkg.in/check.v1"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
. "gopkg.in/check.v1"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -155,7 +156,7 @@ func (s *GoesTestSuite) TestDeleteIndexInexistantIndex(c *C) {
|
|||||||
resp, err := conn.DeleteIndex("foobar")
|
resp, err := conn.DeleteIndex("foobar")
|
||||||
|
|
||||||
c.Assert(err.Error(), Equals, "[404] IndexMissingException[[foobar] missing]")
|
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) {
|
func (s *GoesTestSuite) TestDeleteIndexExistingIndex(c *C) {
|
||||||
@ -170,7 +171,7 @@ func (s *GoesTestSuite) TestDeleteIndexExistingIndex(c *C) {
|
|||||||
resp, err := conn.DeleteIndex(indexName)
|
resp, err := conn.DeleteIndex(indexName)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
expectedResponse := Response{}
|
expectedResponse := &Response{}
|
||||||
expectedResponse.Acknowledged = true
|
expectedResponse.Acknowledged = true
|
||||||
resp.Raw = nil
|
resp.Raw = nil
|
||||||
c.Assert(resp, DeepEquals, expectedResponse)
|
c.Assert(resp, DeepEquals, expectedResponse)
|
||||||
@ -377,7 +378,7 @@ func (s *GoesTestSuite) TestIndexWithFieldsInStruct(c *C) {
|
|||||||
response, err := conn.Index(d, extraArgs)
|
response, err := conn.Index(d, extraArgs)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
expectedResponse := Response{
|
expectedResponse := &Response{
|
||||||
Index: indexName,
|
Index: indexName,
|
||||||
Id: docId,
|
Id: docId,
|
||||||
Type: docType,
|
Type: docType,
|
||||||
@ -442,7 +443,7 @@ func (s *GoesTestSuite) TestIndexIdDefined(c *C) {
|
|||||||
response, err := conn.Index(d, extraArgs)
|
response, err := conn.Index(d, extraArgs)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
expectedResponse := Response{
|
expectedResponse := &Response{
|
||||||
Index: indexName,
|
Index: indexName,
|
||||||
Id: docId,
|
Id: docId,
|
||||||
Type: docType,
|
Type: docType,
|
||||||
@ -511,7 +512,7 @@ func (s *GoesTestSuite) TestDelete(c *C) {
|
|||||||
response, err := conn.Delete(d, url.Values{})
|
response, err := conn.Delete(d, url.Values{})
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
expectedResponse := Response{
|
expectedResponse := &Response{
|
||||||
Found: true,
|
Found: true,
|
||||||
Index: indexName,
|
Index: indexName,
|
||||||
Type: docType,
|
Type: docType,
|
||||||
@ -525,7 +526,7 @@ func (s *GoesTestSuite) TestDelete(c *C) {
|
|||||||
response, err = conn.Delete(d, url.Values{})
|
response, err = conn.Delete(d, url.Values{})
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
expectedResponse = Response{
|
expectedResponse = &Response{
|
||||||
Found: false,
|
Found: false,
|
||||||
Index: indexName,
|
Index: indexName,
|
||||||
Type: docType,
|
Type: docType,
|
||||||
@ -586,7 +587,7 @@ func (s *GoesTestSuite) TestDeleteByQuery(c *C) {
|
|||||||
|
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
expectedResponse := Response{
|
expectedResponse := &Response{
|
||||||
Found: false,
|
Found: false,
|
||||||
Index: "",
|
Index: "",
|
||||||
Type: "",
|
Type: "",
|
||||||
@ -631,7 +632,7 @@ func (s *GoesTestSuite) TestGet(c *C) {
|
|||||||
response, err := conn.Get(indexName, docType, docId, url.Values{})
|
response, err := conn.Get(indexName, docType, docId, url.Values{})
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
expectedResponse := Response{
|
expectedResponse := &Response{
|
||||||
Index: indexName,
|
Index: indexName,
|
||||||
Type: docType,
|
Type: docType,
|
||||||
Id: docId,
|
Id: docId,
|
||||||
@ -648,7 +649,7 @@ func (s *GoesTestSuite) TestGet(c *C) {
|
|||||||
response, err = conn.Get(indexName, docType, docId, fields)
|
response, err = conn.Get(indexName, docType, docId, fields)
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
expectedResponse = Response{
|
expectedResponse = &Response{
|
||||||
Index: indexName,
|
Index: indexName,
|
||||||
Type: docType,
|
Type: docType,
|
||||||
Id: docId,
|
Id: docId,
|
||||||
@ -1141,7 +1142,7 @@ func (s *GoesTestSuite) TestUpdate(c *C) {
|
|||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
time.Sleep(200 * time.Millisecond)
|
time.Sleep(200 * time.Millisecond)
|
||||||
|
|
||||||
expectedResponse := Response{
|
expectedResponse := &Response{
|
||||||
Index: indexName,
|
Index: indexName,
|
||||||
Id: docId,
|
Id: docId,
|
||||||
Type: docType,
|
Type: docType,
|
||||||
@ -1310,7 +1311,7 @@ func (s *GoesTestSuite) TestAddAlias(c *C) {
|
|||||||
response, err := conn.Get(aliasName, docType, docId, url.Values{})
|
response, err := conn.Get(aliasName, docType, docId, url.Values{})
|
||||||
c.Assert(err, IsNil)
|
c.Assert(err, IsNil)
|
||||||
|
|
||||||
expectedResponse := Response{
|
expectedResponse := &Response{
|
||||||
Index: indexName,
|
Index: indexName,
|
||||||
Type: docType,
|
Type: docType,
|
||||||
Id: docId,
|
Id: docId,
|
||||||
|
Loading…
Reference in New Issue
Block a user