Documentation ¶
Overview ¶
Copyright 2023 Adarga Limited
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at: https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 Adarga Limited ¶
Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the License. You may obtain a copy of the License at: https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MockTigerGraphServer ¶
type MockTigerGraphServer struct { HTTPServer *httptest.Server Calls map[string][]io.Reader Username string Password string // contains filtered or unexported fields }
MockTigerGraphServer behaves like a real TigerGraph HTTP server. It keeps track of calls made to each endpoint.
func NewMockServer ¶
func NewMockServer(username, password string) *MockTigerGraphServer
NewMockServer creates a new *MockTigerGraphServer ready to receive requests. Close() must be called on the result, e.g. via a defer call immediately after creation.
func (*MockTigerGraphServer) Close ¶
func (ms *MockTigerGraphServer) Close()
Close closes the mock server.
func (*MockTigerGraphServer) Mock ¶
func (ms *MockTigerGraphServer) Mock(url string, f handlerFunc)
Mock allows an arbitrary handler to be set for a given URL. This is useful for e.g. returning a different response code
func (*MockTigerGraphServer) MockResponse ¶
func (ms *MockTigerGraphServer) MockResponse(url string, response interface{})
MockResponse sets the mock server to respond with a given response on the supplied url.
func (*MockTigerGraphServer) Reset ¶
func (ms *MockTigerGraphServer) Reset()
Reset resets all mocks and calls on the mock server. This is useful if you want to avoid recreating a mock server every test.