@@ -30,6 +30,7 @@ import (
3030 . "github.com/smartystreets/goconvey/convey"
3131
3232 "github.com/northwesternmutual/grammes/gremconnect"
33+ "github.com/northwesternmutual/grammes/gremerror"
3334)
3435
3536func TestExecuteRequest (t * testing.T ) {
@@ -158,7 +159,17 @@ func TestExecuteRequestErrorRetrievingResponse(t *testing.T) {
158159 jsonMarshalData = func (interface {}) ([]byte , error ) { return nil , errors .New ("ERROR" ) }
159160 Convey ("Given a client that represents the Gremlin client" , t , func () {
160161 dialer := & mockDialerStruct {}
161- dialer .response = newVertexResponse
162+ dialer .response = `
163+ {
164+ "requestId": "61616161-6161-6161-2d61-6161612d6161",
165+ "status": {
166+ "message": "",
167+ "code": 597,
168+ "attributes": {}
169+ },
170+ "result":{"data":null,"meta":{"@type":"g:Map","@value":[]}}
171+ }
172+ `
162173 c , _ := Dial (dialer )
163174 Convey ("When 'executeRequest' is called and retrieving the response throws an error" , func () {
164175 bindings := make (map [string ]string )
@@ -167,6 +178,10 @@ func TestExecuteRequestErrorRetrievingResponse(t *testing.T) {
167178 Convey ("Then the error should be returned" , func () {
168179 So (err , ShouldNotBeNil )
169180 })
181+ Convey ("Then the error should be gremerror.NetworkError" , func () {
182+ _ , ok := err .(* gremerror.NetworkError )
183+ So (ok , ShouldBeTrue )
184+ })
170185 })
171186 })
172187}
0 commit comments