mocks

package
v1.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2026 License: MIT Imports: 4 Imported by: 1 module, 1 package

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 ClienterMock

type ClienterMock struct {
	// DeletePolicyFunc mocks the DeletePolicy method.
	DeletePolicyFunc func(ctx context.Context, id string, headers sdk.Headers) error

	// GetPermissionsBundleFunc mocks the GetPermissionsBundle method.
	GetPermissionsBundleFunc func(ctx context.Context, headers sdk.Headers) (sdk.Bundle, error)

	// GetPolicyFunc mocks the GetPolicy method.
	GetPolicyFunc func(ctx context.Context, id string, headers sdk.Headers) (*models.Policy, error)

	// GetRoleFunc mocks the GetRole method.
	GetRoleFunc func(ctx context.Context, id string, headers sdk.Headers) (*models.Roles, error)

	// GetRolesFunc mocks the GetRoles method.
	GetRolesFunc func(ctx context.Context, headers sdk.Headers) (*models.Roles, error)

	// PostPolicyFunc mocks the PostPolicy method.
	PostPolicyFunc func(ctx context.Context, policy models.PolicyInfo, headers sdk.Headers) (*models.Policy, error)

	// PostPolicyWithIDFunc mocks the PostPolicyWithID method.
	PostPolicyWithIDFunc func(ctx context.Context, id string, policy models.PolicyInfo, headers sdk.Headers) (*models.Policy, error)

	// PutPolicyFunc mocks the PutPolicy method.
	PutPolicyFunc func(ctx context.Context, id string, policy models.Policy, headers sdk.Headers) error
	// contains filtered or unexported fields
}

ClienterMock is a mock implementation of sdk.Clienter.

func TestSomethingThatUsesClienter(t *testing.T) {

	// make and configure a mocked sdk.Clienter
	mockedClienter := &ClienterMock{
		DeletePolicyFunc: func(ctx context.Context, id string, headers sdk.Headers) error {
			panic("mock out the DeletePolicy method")
		},
		GetPermissionsBundleFunc: func(ctx context.Context, headers sdk.Headers) (sdk.Bundle, error) {
			panic("mock out the GetPermissionsBundle method")
		},
		GetPolicyFunc: func(ctx context.Context, id string, headers sdk.Headers) (*models.Policy, error) {
			panic("mock out the GetPolicy method")
		},
		GetRoleFunc: func(ctx context.Context, id string, headers sdk.Headers) (*models.Roles, error) {
			panic("mock out the GetRole method")
		},
		GetRolesFunc: func(ctx context.Context, headers sdk.Headers) (*models.Roles, error) {
			panic("mock out the GetRoles method")
		},
		PostPolicyFunc: func(ctx context.Context, policy models.PolicyInfo, headers sdk.Headers) (*models.Policy, error) {
			panic("mock out the PostPolicy method")
		},
		PostPolicyWithIDFunc: func(ctx context.Context, id string, policy models.PolicyInfo, headers sdk.Headers) (*models.Policy, error) {
			panic("mock out the PostPolicyWithID method")
		},
		PutPolicyFunc: func(ctx context.Context, id string, policy models.Policy, headers sdk.Headers) error {
			panic("mock out the PutPolicy method")
		},
	}

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

}

func (*ClienterMock) DeletePolicy

func (mock *ClienterMock) DeletePolicy(ctx context.Context, id string, headers sdk.Headers) error

DeletePolicy calls DeletePolicyFunc.

func (*ClienterMock) DeletePolicyCalls

func (mock *ClienterMock) DeletePolicyCalls() []struct {
	Ctx     context.Context
	ID      string
	Headers sdk.Headers
}

DeletePolicyCalls gets all the calls that were made to DeletePolicy. Check the length with:

len(mockedClienter.DeletePolicyCalls())

func (*ClienterMock) GetPermissionsBundle

func (mock *ClienterMock) GetPermissionsBundle(ctx context.Context, headers sdk.Headers) (sdk.Bundle, error)

GetPermissionsBundle calls GetPermissionsBundleFunc.

func (*ClienterMock) GetPermissionsBundleCalls

func (mock *ClienterMock) GetPermissionsBundleCalls() []struct {
	Ctx     context.Context
	Headers sdk.Headers
}

GetPermissionsBundleCalls gets all the calls that were made to GetPermissionsBundle. Check the length with:

len(mockedClienter.GetPermissionsBundleCalls())

func (*ClienterMock) GetPolicy

func (mock *ClienterMock) GetPolicy(ctx context.Context, id string, headers sdk.Headers) (*models.Policy, error)

GetPolicy calls GetPolicyFunc.

func (*ClienterMock) GetPolicyCalls

func (mock *ClienterMock) GetPolicyCalls() []struct {
	Ctx     context.Context
	ID      string
	Headers sdk.Headers
}

GetPolicyCalls gets all the calls that were made to GetPolicy. Check the length with:

len(mockedClienter.GetPolicyCalls())

func (*ClienterMock) GetRole

func (mock *ClienterMock) GetRole(ctx context.Context, id string, headers sdk.Headers) (*models.Roles, error)

GetRole calls GetRoleFunc.

func (*ClienterMock) GetRoleCalls

func (mock *ClienterMock) GetRoleCalls() []struct {
	Ctx     context.Context
	ID      string
	Headers sdk.Headers
}

GetRoleCalls gets all the calls that were made to GetRole. Check the length with:

len(mockedClienter.GetRoleCalls())

func (*ClienterMock) GetRoles

func (mock *ClienterMock) GetRoles(ctx context.Context, headers sdk.Headers) (*models.Roles, error)

GetRoles calls GetRolesFunc.

func (*ClienterMock) GetRolesCalls

func (mock *ClienterMock) GetRolesCalls() []struct {
	Ctx     context.Context
	Headers sdk.Headers
}

GetRolesCalls gets all the calls that were made to GetRoles. Check the length with:

len(mockedClienter.GetRolesCalls())

func (*ClienterMock) PostPolicy

func (mock *ClienterMock) PostPolicy(ctx context.Context, policy models.PolicyInfo, headers sdk.Headers) (*models.Policy, error)

PostPolicy calls PostPolicyFunc.

func (*ClienterMock) PostPolicyCalls

func (mock *ClienterMock) PostPolicyCalls() []struct {
	Ctx     context.Context
	Policy  models.PolicyInfo
	Headers sdk.Headers
}

PostPolicyCalls gets all the calls that were made to PostPolicy. Check the length with:

len(mockedClienter.PostPolicyCalls())

func (*ClienterMock) PostPolicyWithID added in v1.9.0

func (mock *ClienterMock) PostPolicyWithID(ctx context.Context, id string, policy models.PolicyInfo, headers sdk.Headers) (*models.Policy, error)

PostPolicyWithID calls PostPolicyWithIDFunc.

func (*ClienterMock) PostPolicyWithIDCalls added in v1.9.0

func (mock *ClienterMock) PostPolicyWithIDCalls() []struct {
	Ctx     context.Context
	ID      string
	Policy  models.PolicyInfo
	Headers sdk.Headers
}

PostPolicyWithIDCalls gets all the calls that were made to PostPolicyWithID. Check the length with:

len(mockedClienter.PostPolicyWithIDCalls())

func (*ClienterMock) PutPolicy

func (mock *ClienterMock) PutPolicy(ctx context.Context, id string, policy models.Policy, headers sdk.Headers) error

PutPolicy calls PutPolicyFunc.

func (*ClienterMock) PutPolicyCalls

func (mock *ClienterMock) PutPolicyCalls() []struct {
	Ctx     context.Context
	ID      string
	Policy  models.Policy
	Headers sdk.Headers
}

PutPolicyCalls gets all the calls that were made to PutPolicy. Check the length with:

len(mockedClienter.PutPolicyCalls())

Jump to

Keyboard shortcuts

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