Documentation
¶
Index ¶
- type ClientBaseCase
- func (c *ClientBaseCase) MockDelete(path string, response interface{})
- func (c *ClientBaseCase) MockGet(path string, response interface{})
- func (c *ClientBaseCase) MockPost(path string, response interface{})
- func (c *ClientBaseCase) MockPut(path string, response interface{})
- func (c *ClientBaseCase) SetUp(t *testing.T)
- func (c *ClientBaseCase) TearDown(t *testing.T)
- type MockResponse
- type MonitorClientBaseCase
- type TestFixtures
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClientBaseCase ¶
type ClientBaseCase struct {
Client *linodego.Client
Mock *mock.Mock
BaseURL string // Base URL up to /v4
}
ClientBaseCase provides a base for unit tests
func (*ClientBaseCase) MockDelete ¶
func (c *ClientBaseCase) MockDelete(path string, response interface{})
MockDelete mocks a DELETE request for a given path with the provided response body
func (*ClientBaseCase) MockGet ¶
func (c *ClientBaseCase) MockGet(path string, response interface{})
MockGet mocks a GET request to the client
func (*ClientBaseCase) MockPost ¶
func (c *ClientBaseCase) MockPost(path string, response interface{})
MockPost mocks a POST request for a given path with the provided response body
func (*ClientBaseCase) MockPut ¶
func (c *ClientBaseCase) MockPut(path string, response interface{})
MockPut mocks a PUT request for a given path with the provided response body
func (*ClientBaseCase) SetUp ¶
func (c *ClientBaseCase) SetUp(t *testing.T)
SetUp initializes the Linode client using the mock HTTP client
func (*ClientBaseCase) TearDown ¶
func (c *ClientBaseCase) TearDown(t *testing.T)
type MockResponse ¶
type MockResponse struct {
StatusCode int
Body interface{}
}
type MonitorClientBaseCase ¶
type MonitorClientBaseCase struct {
MonitorClient *linodego.MonitorClient
Mock *mock.Mock
BaseURL string // Base monitor-api URL
}
MonitorClientBaseCase provides a base for unit tests
func (*MonitorClientBaseCase) MockPost ¶
func (c *MonitorClientBaseCase) MockPost(path string, response interface{})
MockPost mocks a POST request for a given path with the provided response body
func (*MonitorClientBaseCase) SetUp ¶
func (c *MonitorClientBaseCase) SetUp(t *testing.T)
SetUp initializes the Monitor client using the mock HTTP client
func (*MonitorClientBaseCase) TearDown ¶
func (c *MonitorClientBaseCase) TearDown(t *testing.T)
type TestFixtures ¶
type TestFixtures struct {
// contains filtered or unexported fields
}
TestFixtures manages loading and retrieving test fixtures
func NewTestFixtures ¶
func NewTestFixtures() *TestFixtures
NewTestFixtures creates a new TestFixtures instance
func (*TestFixtures) GetFixture ¶
func (tf *TestFixtures) GetFixture(name string) (interface{}, error)
GetFixture retrieves the fixture data for the given name