mocks

package
v1.115.0 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2026 License: MIT Imports: 5 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheServiceMock

type CacheServiceMock struct {
	// PurgeFunc mocks the Purge method.
	PurgeFunc func(ctx context.Context, params cache.CachePurgeParams, opts ...option.RequestOption) (*cache.CachePurgeResponse, error)
	// contains filtered or unexported fields
}

CacheServiceMock is a mock implementation of cloudflare.CacheService.

func TestSomethingThatUsesCacheService(t *testing.T) {

	// make and configure a mocked cloudflare.CacheService
	mockedCacheService := &CacheServiceMock{
		PurgeFunc: func(ctx context.Context, params cache.CachePurgeParams, opts ...option.RequestOption) (*cache.CachePurgeResponse, error) {
			panic("mock out the Purge method")
		},
	}

	// use mockedCacheService in code that requires cloudflare.CacheService
	// and then make assertions.

}

func (*CacheServiceMock) Purge

Purge calls PurgeFunc.

func (*CacheServiceMock) PurgeCalls

func (mock *CacheServiceMock) PurgeCalls() []struct {
	Ctx    context.Context
	Params cache.CachePurgeParams
	Opts   []option.RequestOption
}

PurgeCalls gets all the calls that were made to Purge. Check the length with:

len(mockedCacheService.PurgeCalls())

type ClienterMock

type ClienterMock struct {
	// PurgeByPrefixesFunc mocks the PurgeByPrefixes method.
	PurgeByPrefixesFunc func(ctx context.Context, prefixes []string) error
	// contains filtered or unexported fields
}

ClienterMock is a mock implementation of cloudflare.Clienter.

func TestSomethingThatUsesClienter(t *testing.T) {

	// make and configure a mocked cloudflare.Clienter
	mockedClienter := &ClienterMock{
		PurgeByPrefixesFunc: func(ctx context.Context, prefixes []string) error {
			panic("mock out the PurgeByPrefixes method")
		},
	}

	// use mockedClienter in code that requires cloudflare.Clienter
	// and then make assertions.

}

func (*ClienterMock) PurgeByPrefixes

func (mock *ClienterMock) PurgeByPrefixes(ctx context.Context, prefixes []string) error

PurgeByPrefixes calls PurgeByPrefixesFunc.

func (*ClienterMock) PurgeByPrefixesCalls

func (mock *ClienterMock) PurgeByPrefixesCalls() []struct {
	Ctx      context.Context
	Prefixes []string
}

PurgeByPrefixesCalls gets all the calls that were made to PurgeByPrefixes. Check the length with:

len(mockedClienter.PurgeByPrefixesCalls())

Jump to

Keyboard shortcuts

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