encryptionmock

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: AGPL-3.0 Imports: 3 Imported by: 0

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