mocks

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 21, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// DefaultDNSRecord is used as the default option for the corresponding function
	DefaultDNSRecord sdk.DNSRecord = sdk.DNSRecord{
		ID:       "1234",
		Type:     "TXT",
		Name:     "test",
		Content:  "foobar",
		ZoneID:   "zone1234",
		ZoneName: "foo.bar",
		Proxied:  boolPtr(false),
	}

	// DefaultDNSRecords is used as the default option for the corresponding function
	DefaultDNSRecords []sdk.DNSRecord = []sdk.DNSRecord{DefaultDNSRecord}

	// DefaultZoneID is used as the default option for the corresponding function
	DefaultZoneID string = "zone1234"
)
View Source
var (

	// DefaultExternalIPAddress is the default IP address returned
	DefaultExternalIPAddress = "1.2.3.4"

	// DefaultDoResponse is the default response for this function
	DefaultDoResponse *http.Response = &http.Response{
		StatusCode: 200,
		Body:       io.NopCloser(strings.NewReader(DefaultExternalIPAddress)),
	}
)
View Source
var (
	// DefaultSchedulerDoResponse is the default response for this function
	DefaultSchedulerDoResponse *gocron.Job = &gocron.Job{}
)

Functions

This section is empty.

Types

type ErrorReader

type ErrorReader struct {
	Error error
}

ErrorReader is a mocked io.ReadCloser that returns erorr when reading

func (*ErrorReader) Close

func (e *ErrorReader) Close() error

Close returns an error when closing the reader

func (*ErrorReader) Read

func (e *ErrorReader) Read(p []byte) (n int, err error)

Read returns an error when reading

type MockCloudflareSDKClient

type MockCloudflareSDKClient struct{}

MockCloudflareSDKClient mocks the internal client from Cloudflare

func (*MockCloudflareSDKClient) CreateDNSRecord

func (c *MockCloudflareSDKClient) CreateDNSRecord(ctx context.Context, zoneID string, rr sdk.DNSRecord) (*sdk.DNSRecordResponse, error)

CreateDNSRecord implements corresponding client function

func (*MockCloudflareSDKClient) DNSRecord

func (c *MockCloudflareSDKClient) DNSRecord(ctx context.Context, zoneID string, recordID string) (sdk.DNSRecord, error)

DNSRecord implements corresponding client function

func (*MockCloudflareSDKClient) DNSRecords

func (c *MockCloudflareSDKClient) DNSRecords(ctx context.Context, zoneID string, rr sdk.DNSRecord) ([]sdk.DNSRecord, error)

DNSRecords implements corresponding client function

func (*MockCloudflareSDKClient) DeleteDNSRecord

func (c *MockCloudflareSDKClient) DeleteDNSRecord(ctx context.Context, zoneID string, recordID string) error

DeleteDNSRecord implements corresponding client function

func (*MockCloudflareSDKClient) UpdateDNSRecord

func (c *MockCloudflareSDKClient) UpdateDNSRecord(ctx context.Context, zoneID string, recordID string, rr sdk.DNSRecord) error

UpdateDNSRecord implements corresponding client function

func (*MockCloudflareSDKClient) ZoneIDByName

func (c *MockCloudflareSDKClient) ZoneIDByName(zoneName string) (string, error)

ZoneIDByName implements corresponding client function

type MockHTTPClient

type MockHTTPClient struct{}

MockHTTPClient mocks the internal client for http.Client

func (*MockHTTPClient) Do

func (c *MockHTTPClient) Do(req *http.Request) (*http.Response, error)

Do implements corresponding client function

type MockSchedulerClient

type MockSchedulerClient struct{}

MockSchedulerClient mocks the internal scheduler

func (*MockSchedulerClient) Do

func (c *MockSchedulerClient) Do(jobFun interface{}, params ...interface{}) (*gocron.Job, error)

Do implements corresponding client function

func (*MockSchedulerClient) StartBlocking

func (c *MockSchedulerClient) StartBlocking()

StartBlocking implements corresponding client function

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL