encryptionmock

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: AGPL-3.0 Imports: 3 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

Overview

Package encryptionmock provides mock implementations of the encryption package's interfaces. Both the hand-written testify-based MockImpl and the moq-generated EncryptorDecryptorMock live here during the testify → moq migration. New test code should prefer EncryptorDecryptorMock.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EncryptorDecryptorMock

type EncryptorDecryptorMock struct {
	// DecryptFunc mocks the Decrypt method.
	DecryptFunc func(ctx context.Context, content string) (string, error)

	// EncryptFunc mocks the Encrypt method.
	EncryptFunc func(ctx context.Context, content string) (string, error)
	// contains filtered or unexported fields
}

EncryptorDecryptorMock is a mock implementation of encryption.EncryptorDecryptor.

func TestSomethingThatUsesEncryptorDecryptor(t *testing.T) {

	// make and configure a mocked encryption.EncryptorDecryptor
	mockedEncryptorDecryptor := &EncryptorDecryptorMock{
		DecryptFunc: func(ctx context.Context, content string) (string, error) {
			panic("mock out the Decrypt method")
		},
		EncryptFunc: func(ctx context.Context, content string) (string, error) {
			panic("mock out the Encrypt method")
		},
	}

	// use mockedEncryptorDecryptor in code that requires encryption.EncryptorDecryptor
	// and then make assertions.

}

func (*EncryptorDecryptorMock) Decrypt

func (mock *EncryptorDecryptorMock) Decrypt(ctx context.Context, content string) (string, error)

Decrypt calls DecryptFunc.

func (*EncryptorDecryptorMock) DecryptCalls

func (mock *EncryptorDecryptorMock) DecryptCalls() []struct {
	Ctx     context.Context
	Content string
}

DecryptCalls gets all the calls that were made to Decrypt. Check the length with:

len(mockedEncryptorDecryptor.DecryptCalls())

func (*EncryptorDecryptorMock) Encrypt

func (mock *EncryptorDecryptorMock) Encrypt(ctx context.Context, content string) (string, error)

Encrypt calls EncryptFunc.

func (*EncryptorDecryptorMock) EncryptCalls

func (mock *EncryptorDecryptorMock) EncryptCalls() []struct {
	Ctx     context.Context
	Content string
}

EncryptCalls gets all the calls that were made to Encrypt. Check the length with:

len(mockedEncryptorDecryptor.EncryptCalls())

Jump to

Keyboard shortcuts

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