Documentation
¶
Index ¶
- Variables
- type NeptunePoolMock
- func (mock *NeptunePoolMock) Close()
- func (mock *NeptunePoolMock) CloseCalls() []struct{}
- func (mock *NeptunePoolMock) Execute(query string, bindings map[string]string, rebindings map[string]string) ([]gremgo.Response, error)
- func (mock *NeptunePoolMock) ExecuteCalls() []struct{ ... }
- func (mock *NeptunePoolMock) Get(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error)
- func (mock *NeptunePoolMock) GetCalls() []struct{ ... }
- func (mock *NeptunePoolMock) GetCount(q string, bindings map[string]string, rebindings map[string]string) (int64, error)
- func (mock *NeptunePoolMock) GetCountCalls() []struct{ ... }
- func (mock *NeptunePoolMock) GetE(q string, bindings map[string]string, rebindings map[string]string) (interface{}, error)
- func (mock *NeptunePoolMock) GetECalls() []struct{ ... }
- func (mock *NeptunePoolMock) GetStringList(query string, bindings map[string]string, rebindings map[string]string) ([]string, error)
- func (mock *NeptunePoolMock) GetStringListCalls() []struct{ ... }
- func (mock *NeptunePoolMock) OpenStreamCursor(ctx context.Context, query string, bindings map[string]string, ...) (*gremgo.Stream, error)
- func (mock *NeptunePoolMock) OpenStreamCursorCalls() []struct{ ... }
Constants ¶
This section is empty.
Variables ¶
var ReturnFiveStrings = func(q string, bindings, rebindings map[string]string) ([]string, error) { return []string{"a", "b", "c", "d", "e"}, nil }
ReturnFiveStrings is a mock implementation for NeptunePool functions that return ([]string, error) which always returns five strings.
var ReturnMalformedIntRequestErr = func(q string, bindings, rebindings map[string]string) (i int64, err error) { return -1, errors.New(" MALFORMED REQUEST ") }
ReturnMalformedIntRequestErr is a mock implementation for NeptunePool.GetCount() that always returns an error that is judged to be not transient by neptune.isTransientError
var ReturnMalformedNilInterfaceRequestErr = func(q string, bindings, rebindings map[string]string) ([]graphson.Vertex, error) { return nil, errors.New(" MALFORMED REQUEST ") }
ReturnMalformedNilInterfaceRequestErr is a mock implementation for NeptunePool functions that return ([]graphson.Vertex, error) which always returns an error that is judged to be not transient by neptune.isTransientError
var ReturnMalformedStringListRequestErr = func(q string, bindings, rebindings map[string]string) ([]string, error) { return nil, errors.New(" MALFORMED REQUEST ") }
ReturnMalformedStringListRequestErr is a mock implementation for NeptunePool functions that return ([]string, error) which always returns an error that is judged to be not transient by neptune.isTransientError
var ReturnOne = func(q string, bindings, rebindings map[string]string) (i int64, err error) { return 1, nil }
ReturnOne is a mock implementation for NeptunePool.GetCount() that always returns a count of 1.
var ReturnProperlyFormedDatasetRecord = func(q string, bindings, rebindings map[string]string) ([]string, error) { return []string{"exampleDimName", "exampleDatasetEdition", "3", "exampleDatasetID"}, nil }
ReturnProperlyFormedDatasetRecord is a mock implementation for NeptunePool functions that return ([]string, error) which always returns A single quartet of strings that should satisfy the GetCodeDatasets method.
var ReturnStringRecordWithNonIntegerFourthElement = func(q string, bindings, rebindings map[string]string) ([]string, error) { return []string{"1", "2", "fibble", "3"}, nil }
ReturnStringRecordWithNonIntegerFourthElement is a mock implementation for NeptunePool functions that return ([]string, error) which always returns 4 strings - in which the third one cannot be cast to an integer.
var ReturnThreeCodeLists = func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) { codeLists := []graphson.Vertex{} for i := 0; i < 3; i++ { vertex := makeCodeListVertex(i, "my-test-edition") codeLists = append(codeLists, vertex) } return codeLists, nil }
ReturnThreeCodeLists is mock implementation for NeptunePool.Get() that always returns a slice of three graphson.Vertex(s): - of type "_code_list" - with a "listID" property set to "listID_0", "listID_1", and "ListID_2" respectively. - with an "edition" property set to "my-test-edition"
var ReturnThreeCodeVertices = func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) { codes := []graphson.Vertex{} for i := 0; i < 3; i++ { vertex := makeVertex("unused-vertex-type") setVertexStringProperty(&vertex, "value", fmt.Sprintf("code_%d", i)) codes = append(codes, vertex) } return codes, nil }
ReturnThreeCodeVertices is mock implementation for NeptunePool.Get() that always returns a slice of three graphson.Vertex(s): - of type "unused-vertex-type" - with a "value" property set to "code_0", "code_1", and "code_2" respectively.
var ReturnThreeEditionVertices = func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) { editions := []graphson.Vertex{} for i := 0; i < 3; i++ { vertex := makeVertex("unused-vertex-type") setVertexStringProperty(&vertex, "edition", fmt.Sprintf("edition_%d", i)) editions = append(editions, vertex) } return editions, nil }
ReturnThreeEditionVertices is mock implementation for NeptunePool.Get() that always returns a slice of three graphson.Vertex(s): - of type "unused-vertex-type" - with a an "edition" property set to "edition_0", "edition_1", and "edition_2" respectively.
var ReturnThreeUselessVertices = func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) { codeLists := []graphson.Vertex{} for i := 0; i < 3; i++ { vertex := makeVertex("_useless_vertex_type") codeLists = append(codeLists, vertex) } return codeLists, nil }
ReturnThreeUselessVertices is mock implementation for NeptunePool.Get() that always returns a slice of three graphson.Vertex(s) of type "_useless_vertex_type", and with no properties set.
var ReturnTwo = func(q string, bindings, rebindings map[string]string) (i int64, err error) { return 2, nil }
ReturnTwo is a mock implementation for NeptunePool.GetCount() that always returns a count of 2.
var ReturnZero = func(q string, bindings, rebindings map[string]string) (i int64, err error) { return 0, nil }
ReturnZero is a mock implementation for NeptunePool.GetCount() that always returns a count of 0.
var ReturnZeroVertices = func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) { return []graphson.Vertex{}, nil }
ReturnZeroVertices provides an empty list of graphson.Vertex(s)
Functions ¶
This section is empty.
Types ¶
type NeptunePoolMock ¶
type NeptunePoolMock struct {
// CloseFunc mocks the Close method.
CloseFunc func()
// ExecuteFunc mocks the Execute method.
ExecuteFunc func(query string, bindings map[string]string, rebindings map[string]string) ([]gremgo.Response, error)
// GetFunc mocks the Get method.
GetFunc func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error)
// GetCountFunc mocks the GetCount method.
GetCountFunc func(q string, bindings map[string]string, rebindings map[string]string) (int64, error)
// GetEFunc mocks the GetE method.
GetEFunc func(q string, bindings map[string]string, rebindings map[string]string) (interface{}, error)
// GetStringListFunc mocks the GetStringList method.
GetStringListFunc func(query string, bindings map[string]string, rebindings map[string]string) ([]string, error)
// OpenStreamCursorFunc mocks the OpenStreamCursor method.
OpenStreamCursorFunc func(ctx context.Context, query string, bindings map[string]string, rebindings map[string]string) (*gremgo.Stream, error)
// contains filtered or unexported fields
}
NeptunePoolMock is a mock implementation of driver.NeptunePool.
func TestSomethingThatUsesNeptunePool(t *testing.T) {
// make and configure a mocked driver.NeptunePool
mockedNeptunePool := &NeptunePoolMock{
CloseFunc: func() {
panic("mock out the Close method")
},
ExecuteFunc: func(query string, bindings map[string]string, rebindings map[string]string) ([]gremgo.Response, error) {
panic("mock out the Execute method")
},
GetFunc: func(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error) {
panic("mock out the Get method")
},
GetCountFunc: func(q string, bindings map[string]string, rebindings map[string]string) (int64, error) {
panic("mock out the GetCount method")
},
GetEFunc: func(q string, bindings map[string]string, rebindings map[string]string) (interface{}, error) {
panic("mock out the GetE method")
},
GetStringListFunc: func(query string, bindings map[string]string, rebindings map[string]string) ([]string, error) {
panic("mock out the GetStringList method")
},
OpenStreamCursorFunc: func(ctx context.Context, query string, bindings map[string]string, rebindings map[string]string) (*gremgo.Stream, error) {
panic("mock out the OpenStreamCursor method")
},
}
// use mockedNeptunePool in code that requires driver.NeptunePool
// and then make assertions.
}
func (*NeptunePoolMock) CloseCalls ¶
func (mock *NeptunePoolMock) CloseCalls() []struct { }
CloseCalls gets all the calls that were made to Close. Check the length with:
len(mockedNeptunePool.CloseCalls())
func (*NeptunePoolMock) Execute ¶
func (mock *NeptunePoolMock) Execute(query string, bindings map[string]string, rebindings map[string]string) ([]gremgo.Response, error)
Execute calls ExecuteFunc.
func (*NeptunePoolMock) ExecuteCalls ¶
func (mock *NeptunePoolMock) ExecuteCalls() []struct { Query string Bindings map[string]string Rebindings map[string]string }
ExecuteCalls gets all the calls that were made to Execute. Check the length with:
len(mockedNeptunePool.ExecuteCalls())
func (*NeptunePoolMock) Get ¶
func (mock *NeptunePoolMock) Get(query string, bindings map[string]string, rebindings map[string]string) ([]graphson.Vertex, error)
Get calls GetFunc.
func (*NeptunePoolMock) GetCalls ¶
func (mock *NeptunePoolMock) GetCalls() []struct { Query string Bindings map[string]string Rebindings map[string]string }
GetCalls gets all the calls that were made to Get. Check the length with:
len(mockedNeptunePool.GetCalls())
func (*NeptunePoolMock) GetCount ¶
func (mock *NeptunePoolMock) GetCount(q string, bindings map[string]string, rebindings map[string]string) (int64, error)
GetCount calls GetCountFunc.
func (*NeptunePoolMock) GetCountCalls ¶
func (mock *NeptunePoolMock) GetCountCalls() []struct { Q string Bindings map[string]string Rebindings map[string]string }
GetCountCalls gets all the calls that were made to GetCount. Check the length with:
len(mockedNeptunePool.GetCountCalls())
func (*NeptunePoolMock) GetE ¶
func (mock *NeptunePoolMock) GetE(q string, bindings map[string]string, rebindings map[string]string) (interface{}, error)
GetE calls GetEFunc.
func (*NeptunePoolMock) GetECalls ¶
func (mock *NeptunePoolMock) GetECalls() []struct { Q string Bindings map[string]string Rebindings map[string]string }
GetECalls gets all the calls that were made to GetE. Check the length with:
len(mockedNeptunePool.GetECalls())
func (*NeptunePoolMock) GetStringList ¶
func (mock *NeptunePoolMock) GetStringList(query string, bindings map[string]string, rebindings map[string]string) ([]string, error)
GetStringList calls GetStringListFunc.
func (*NeptunePoolMock) GetStringListCalls ¶
func (mock *NeptunePoolMock) GetStringListCalls() []struct { Query string Bindings map[string]string Rebindings map[string]string }
GetStringListCalls gets all the calls that were made to GetStringList. Check the length with:
len(mockedNeptunePool.GetStringListCalls())
func (*NeptunePoolMock) OpenStreamCursor ¶
func (mock *NeptunePoolMock) OpenStreamCursor(ctx context.Context, query string, bindings map[string]string, rebindings map[string]string) (*gremgo.Stream, error)
OpenStreamCursor calls OpenStreamCursorFunc.
func (*NeptunePoolMock) OpenStreamCursorCalls ¶
func (mock *NeptunePoolMock) OpenStreamCursorCalls() []struct { Ctx context.Context Query string Bindings map[string]string Rebindings map[string]string }
OpenStreamCursorCalls gets all the calls that were made to OpenStreamCursor. Check the length with:
len(mockedNeptunePool.OpenStreamCursorCalls())