Browse Source

Update tests to handle *Response rather than Response

tags/v1.0.0
Paul Bonser 9 years ago
parent
commit
fd0653ffa9
1 changed files with 13 additions and 12 deletions
  1. +13
    -12
      goes_test.go

+ 13
- 12
goes_test.go View File

@@ -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,


Loading…
Cancel
Save